In the literature I've found two notions of "$\pi$-cocartesian morphism" in a category, and to my knowledge they're not equivalent.
The first and I think most common one is the following :
Let $\pi : D\to C$ be a functor. A morphism $\phi:X\to Y$ of $D$ is said to be $\pi$-cocartesian if for any $\psi:X\to Z$ and any map $\rho:\pi Y\to \pi Z$ such that $\pi\psi=\rho\circ\pi \phi$, there exists a unique lift of $\rho$, i.e. a map $\epsilon:Y\to Z$ s.t. $\pi(\epsilon)=\rho$ and $\psi=\epsilon\phi$.
This definition can for instance be found on the nlab.
There's a second definition I've found, most notably in "La théorie de l'homotopie de Grothendieck" by Georges Maltsiniotis (it's in French). It goes as follows:
Let $\pi : D\to C$ be a functor. A morphism $\phi:X\to Y$ of $D$ is said to be $\pi$-cocartesian if for any $\psi : X\to Z$ s.t. $\pi(\psi)=\pi(\phi)$, there exists a unique $g:Y\to Z$ s.t. $\pi(g)=1_{\pi(Y)}$ and $\psi=g\circ\phi$.
I think I can prove that the first implies the second (see below) but I can't prove the second implies the first, and I'm starting to suspect the two might not be equivalent. Does anyone know / see why they are/ aren't equivalent ?
Assume $\phi:X\to Y$ is $\pi$-cocartesian, as in the first definition. Let $\psi$ be any map $X\to Z$ s.t. $\pi (\phi)=\pi(\psi)$. To use our second definition, we can take $\rho = 1_{\pi(Y)}$, since $\pi(\phi)=\pi(\psi)$, they have the same codomain, i.e. $\pi Z=\pi Y$ and its clear that $\pi(\psi)=1_{\pi Y}\pi\phi$. Hence since $\phi$ cocartesian (as in the first def) there exists a unique map $\epsilon :Y\to Z$ making the relevant triangle commute and s.t. $\pi \epsilon = 1_{\pi Y}$, so $\phi$ is cocartesian as in the second definition. I cannot seem to find a proof the other way, suggesting that the two may not be equivalent.
The first definition is what we would usually call a $\pi$-cocartesian morphism, and the second is also known as a locally $\pi$-cocartesian morphism. As this name suggests, the definitions are not equivalent. The idea is as follows: write $[1]$ for the one-arrow category. Then, in the situation of your second definition, we can form a pullback square $$\require{AMScd}\begin{CD}[1]\times_CD@>>> D\\ @V{\pi'}VV @VV{\pi}V\\ [1] @>{\pi(\varphi)}>> C \end{CD}$$ of categories. Now the morphism $\varphi$ is locally $\pi$-cocartesian iff it is a $\pi'$-cocartesian morphism in the category $[1]\times_{C}D$. Since the category $[1]\times_CD$ may be much smaller than $D$, locally $\pi$-cocartesian morphisms generally are not $\pi$-cocartesian, and you can construct counterexamples using this idea.