$A \cong B \otimes_D C $ from some commutative diagram of rings Let $B$ , $D$ are local ring and assume that we have a commutative diagram :
$$
\newcommand{\ra}[1]{\!\!\!\!\!\!\!\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!\!\!\!}
\newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.}
%
\begin{array}{llllllllllll}
 A:=B/ \langle f(\mathfrak{m}_D)\rangle \ &  \ \xleftarrow {\pi' } \ & B   \\
 \uparrow{h}& & \uparrow {f} & &    \\
 C:=D/\mathfrak{m}_D & \xleftarrow{\pi} & D &    \\
\end{array}
$$
, where $\mathfrak{m}_D$ is the maximal ideal of $D$, $\langle f(\mathfrak{m}_D)\rangle$ is the ideal generated by $f(\mathfrak{m}_D)$, and $\pi$, $\pi'$ are the natural surjections. And each homomorphisms are local homomorphisms sending $1$ to $1$.
Then, in this case, $A \cong B \otimes_DC$ ? If not, what property can be added to show the isomorphism?
My first attempt is, first, note that since $C$ is a field and $h$ sends $1$ to $1$, $h$ is injective.
Second, let's define $\varphi : B \otimes_D C \to A$ as $b\otimes (d+m_D) \mapsto \pi'(b)h(d+m_D)=(b+\langle f(m_D)\rangle)(f(d)+\langle f(m_D)\rangle) = bf(d)+ \langle f(\mathfrak{m}_D) \rangle$
(whre the first equality is by the above commutative diagram).
We can show that this is a well-defined surjective ring homomorphism ( if needed, I'will provide detail).
And I stuck at showing the injectivity. Assume that $ \varphi(b\otimes (d+m_D)) = bf(d)+\langle f(\mathfrak{m}_D)\rangle =0$. Then we can express $bf(d)=r_1f(d_1) + \cdots r_nf(d_n)$, where $r_i \in B, d_i \in \mathfrak{m}_D$.
Case 1) $d+ \mathfrak{m}_D = 0$ : In this case, $b\otimes (d+m_D)=0$ and we are done.
Case 2) $d+ \mathfrak{m}_D \neq 0$ : In this case, $d \in D $ is unit in $D$ so there exists $d^{-1} \in D$. So we have
$$ b = bf(d)f(d^{-1}) = [r_1f(d_1) + \cdots r_nf(d_n)]f(d^{-1})=r_1f(d_1d^{-1}) + \cdots r_nf(d_nd^{-1})$$
Then, $b \otimes (d+m_D) = (r_1f(d_1d^{-1})\otimes (d+m_D)) + \cdots (r_nf(d_nd^{-1})\otimes (d+m_D)) =0 $ ?
How can we show that $\varphi $ is injective? Or..is there any other method to prove that $A \cong B \otimes_D C$?
C.f. This question is asscociated with the next question that I proposed, that not yet answered.
: Showing that $\mathcal{O}_{f^{-1}(y),x} \cong \mathcal{O}_{X,x} \otimes_{\mathcal{O}_{Y,y}} \kappa(y)$
If our question is true, then for a morphism of schemes (locally of finite type) $f:X\to Y$, $x\in X, y=f(x)$, we can show that $\mathcal{O}_{f^{-1}(y),x} \cong \mathcal{O}_{X,x} \otimes_{\mathcal{O}_{Y,y}} \kappa(y)$.
Anyway, is our question true?
Can anyone help?
Some investigation : Consider next diagram ( $p$ : a prime )
$$
\newcommand{\ra}[1]{\!\!\!\!\!\!\!\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!\!\!\!}
\newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.}
%
\begin{array}{llllllllllll}
 \mathbb{Z}/p^2 \mathbb{Z} / \langle f(p\mathbb{Z} / p^4 \mathbb{Z})\rangle \ &  \ \xleftarrow {\pi' } \ & \mathbb{Z}/p^2\mathbb{Z}   \\
 \uparrow{h}& & \uparrow {f} & &    \\
 (\mathbb{Z}/p^4 \mathbb{Z})/(p\mathbb{Z}/p^4 \mathbb{Z}) & \xleftarrow{\pi} & \mathbb{Z}/p^4 \mathbb{Z} &    \\
\end{array}
$$
where $f: \mathbb{Z}/p^4 \mathbb{Z} \to \mathbb{Z}/p^2 \mathbb{Z}$ is the map $x + p^4 \mathbb{Z} \mapsto x+ p^2\mathbb{Z}$. Note that $\langle f(p\mathbb{Z} / p^4 \mathbb{Z})\rangle = p \mathbb{Z}/ p^2 \mathbb{Z}$ (true?). Let $h $ be $(x+p^4 \mathbb{Z}) + (p\mathbb{Z}/p^4 \mathbb{Z}) \mapsto (x+p^2\mathbb{Z})+(p\mathbb{Z}/p^2 \mathbb{Z})$ (well-defined?).
Then the above diagram commutes(?) and satisfies the conditions in our question.(true?) So, if our question is true, then we have
$$(\mathbb{Z}/p^2 \mathbb{Z})/(p\mathbb{Z}/p^2\mathbb{Z}) 
 \cong \mathbb{Z}/p^2 \mathbb{Z}  \otimes_{\mathbb{Z}/p^4\mathbb{Z}} 
 ((\mathbb{Z}/p^4\mathbb{Z})/(p\mathbb{Z}/p^4 \mathbb{Z}))$$
And note that $(\mathbb{Z}/p^2 \mathbb{Z})/(p\mathbb{Z}/p^2\mathbb{Z}) \cong \mathbb{Z}/p\mathbb{Z} \cong ((\mathbb{Z}/p^4\mathbb{Z})/(p\mathbb{Z}/p^4 \mathbb{Z}))$ by the third isomorphism theorem. So we get
$$ \mathbb{Z}/p \mathbb{Z} \cong \mathbb{Z}/p^2 \mathbb{Z} \otimes _{\mathbb{Z}/p^4 \mathbb{Z}} \mathbb{Z}/p\mathbb{Z}$$
And this is true? (Am I argue correctly?) Uhm..can it be a counter example to our question?
 A: Note: My ring $A$ here is different than yours - sorry for the confusion! To get the situation you described, let my ring $A$ be your ring $D$, and my $B$ be your $B$, and $I=\mathfrak{m}_D$.
I think the answer to your question is yes. We can show this pretty much just using universal properties. We can also drop the local ring requirement. I assume all rings are commutative and unital, because you seem to be interested in this question for the sake of studying schemes.
Let $f:A\to B$ be a ring morphism and $I\subseteq A$ an ideal. Then $B/\langle f(I)\rangle$ is naturally isomorphic to $B\otimes_AA/I$ as an $A$-algebra.
Proof. Recall the tensor product of two algebras is the same as the fibered product over the base ring in the category of rings (if you prefer you can think of this happening in the category of $A$-algebras instead). So we want to show the square

satisfies the property that whenever $a:A/I\to C$, $b:B\to C$ are maps such that $bf=a\pi$, there exists a unique map $g$ such that

commutes.
In order to construct such a $g$, note that whenever $x\in I$, $qf(x)=p\pi(x)=0$, so $q(f(I))=\{0\}$. Thus $q(\langle f(I)\rangle)=\{0\}$, so by the universal property of quotients it must factor uniquely through $\pi'$: this is how we get $g$. This already ensures $g$ is unique and $g\pi'=q$, so it remains to verify $gh=p$. But note $gh\pi=g\pi'f$ since the original square commutes, as it's how $h$ was constructed. So we get $g\pi'f=qf=p\pi$, so $gh\pi=p\pi$. Since $\pi$ is an epimorphism, $gh=p$ as desired. Thus we indeed have $B/\langle f(I)\rangle\cong B\otimes_AA/I$.

Since this is not really the direction you were going, I'll try and finish your original proof. We wish to construct an isomorphism between $B\otimes_AA/I$ and $B/\langle f(I)\rangle$. You did this by letting $\varphi:B\otimes_AA/I\to B/\langle f(I)\rangle$ be defined by $\varphi(b\otimes\pi(a))=\pi'(b)h(\pi(a))$ and as you said this is a well-defined surjection.
To show it is an injection, we want to show if $\varphi(x)=0$, then $x=0$. Notice any element $x$ of $B\otimes_AA/I$ can be written as a sum of the basis elements: $x=\sum b_i\otimes\pi(a_i)$. But since this is the tensor product of $A$-algebras, $a_i\cdot\pi(1)=\pi(a_i)$, where by $a_i\cdot$ I mean the action of $a_i$ on an element of $A/I$. So we actually have
\begin{align*}
b_i\otimes\pi(a_i)=a_i\cdot(b_i\otimes\pi(1))=(a_i\cdot b_i)\otimes\pi(1)=f(a_i)b_i\otimes\pi(1),
\end{align*}
which means $x=\sum b_i\otimes\pi(a_i)=\left(\sum f(a_i)b_i\right)\otimes\pi(1)$.
Plugging this in gives $\varphi(x)=\pi'\left(\sum f(a_i)b_i\right)h(\pi(1))=\pi'\left(\sum f(a_i)b_i\right)$. If this equals $0$, $\sum f(a_i)b_i$ must be in the ideal $\langle f(I)\rangle$, so it equals some $\sum f(r_i)s_i$ with $s_i\in B$ and $r_i\in I$. This tells us
\begin{align*}
x=\left(\sum f(r_i)s_i\right)\otimes\pi(1)=\sum f(r_i)s_i\otimes\pi(1)=\sum r_i\cdot (s_i\otimes\pi(1))=\sum s_i\otimes\pi(r_i)=0.
\end{align*}
