Giving morphism of schemes $\pi$ : $\operatorname{Spec}A \rightarrow \operatorname{Spec}B$, by definition we have $\pi^{-1}\mathscr{O}_{\operatorname{Spec}B}$ is a sheaf of rings on $\operatorname{Spec}A$, i.e., $(\operatorname{Spec}A, \pi^{-1}\mathscr{O}_{\operatorname{Spec}B}$) is a ringed space. With $\pi$ being a mophism of schemes rather than just of ringed spaces, $(\operatorname{Spec}A, \pi^{-1}\mathscr{O}_{\operatorname{Spec}B}$) is also an affine scheme, by argument similar in For a morphism of affine schemes, the inverse of an open affine subscheme is affine. Then it shoud have form $(\operatorname{Spec}C, \mathscr{O}_{\operatorname{Spec}C}$)
Algebraically, which ring is the ring $C$ under the morphism $B \rightarrow A$ ? Considering an example like $\operatorname{Spec}k[x]/(x) \to \operatorname{Spec}k[x]$, I suspect that $C$ is the localization of $B$ with multiplicative set $\pi^{-1}(U(A))$, where $U(A)$ means the units of $A$. But I failed to give a proof of it.
And is there any geometric view point for it?
Thank you in advance.