For a composition to be defined, is the following two a must?
$$f:A\to B, g: C\to D\\ f\circ g : C\to B \\ Domf\circ g\subseteq Dom f\\ Im f\circ g \subseteq Im g $$
Are there other conditionals for the composition to be defined? What about the sets?
Let me take the same stance I took in my answer to your previous question. Function is just a set of ordered pairs, and writing $f\colon A\to B$ we declare that $\operatorname{dom}(f)=A$ and $\operatorname{rng}(f)\subseteq B$.
The composition of any two functions is always defined: $$g\circ f=\{\langle x,z\rangle\mid\exists y:f(x)=y\land g(y)=z\}$$
You can easily check that $g\circ f$ is a function if $g,f$ are functions.
The question is what is the domain of $g\circ f$, and it is not very hard to see that if $\langle x,z\rangle\in g\circ f$, then the witnessing $y$ is unique (since $f(x)$ is unique). Therefore $x\in\operatorname{dom}(g\circ f)$ if and only if $f(x)\in\operatorname{dom}(g)$. In other words, $$\operatorname{dom}(g\circ f)=\operatorname{dom}(f)\cap f^{-1}(\operatorname{dom}(g))=f^{-1}(\operatorname{dom}(g)).$$
The statement that $\operatorname{rng}(g\circ f)\subseteq\operatorname{rng}(g)$ is an easy consequence of the definition.
So, now, if we want $f\circ g\colon C\to B$ to be a true statement, then we need that $\operatorname{dom}(f\circ g)=C$. In other words, we need that $\operatorname{rng}(g)\subseteq\operatorname{dom}(f)=A$.