Aluffi, Exercise 2.12, regarding the cokernel in $\sf{Ring}$ of $\mathbb{Z} \hookrightarrow \mathbb{Q}$

I am working in Aluffi's Algebra: Chapter $0$ textbook, and Chapter 3, Exercise 2.12 asks one to determine the cokernel in $\sf{Ring}$ of the imbedding $i \colon \mathbb{Z} \hookrightarrow \mathbb{Q}$. At the beginning of Chapter 3, Section 5, he hints that the answer is perhaps weird, when he says "Also, cokernels do not behave as one would hope [in $\sf{Ring}$]" and then references this exercise.

Note that Aluffi assumes that all rings are unital and that ring homomorphisms send $1$ to $1$.

Here's my question: Is the statement ill-defined (or perhaps vacuous -- not exactly sure which description is more accurate)? It appears to me that the setup of the cokernel in this situation requires that one start with a ring homomorphism $\varphi \colon \mathbb{Q} \to R$, where $R$ is some ring, satisfying $\varphi(i(n)) = 0$ for all $n \in \mathbb{Z}$, but then $\varphi(i(1)) = \varphi(1) = 0$ contradicting the existence of such a ring homomorphism $\varphi$ (assuming $R$ is not trivial).

Am I missing something? If I am right so far, then one quickly realizes that the same problem occurs for every ring homomorphism $\varphi \colon R \to S$. If this is true, is it better to say that "cokernels do not exist" or that "cokernels are not well-defined" in $\sf{Ring}$?


You've already solved the exercise in the parenthetical remark "assuming $R$ is not trivial." The cokernel exists; it's the zero ring. In fact the cokernel of every (unital) ring homomorphism is the zero ring.

(There's no particular reason to expect cokernels to behave nicely in a category that doesn't even have a zero object, let alone that isn't additive. The correct replacement in general is the cokernel pair, which exists in great generality, and in particular which has the property that a morphism is an epimorphism iff its cokernel pair is trivial.)