Multi-stage build on running app

Hi, I have a question regarding multi-stage build. On the docker docs it tells us that we can use multiple FROM statements with the example of using golang image and alpine. In this case this two image isn’t a running application.

Now I have a erp app that needs to run with postgresql. These two app is a running application. In this case can we use this multi-stage build and still have a connection between these two app?

The idea of build stages is to prepare stuff, like extrecting archives or compiling binaries and then be able to copy the result (like compiled binaries) into the final image. Though, you seem to be looking to create a merged image that inherits multiple base images behavior - that’s not how it works.

Why would you even want to merge services that could run by their own, into a single image? This is where orchestrators like docker-compose (single node, mutli containers) or swarm/kubernetes (multi nodes, multi containers) come into play.

I’m new to docker and still have a misconception with how docker works. Thought that docker works like a vm that’s containerized, that’s why I want to put those two app into one. Thanks for the explanation, will do the docker-compose then.

You might want to research more about the differences. I am sure there are plenty of briliant blog posts with a comparision.

In short: while a virtual machine aims to virtualize a whole computer, a conatiner aims for application virtualization (has no bios, does not boot, has no kernel and no system daemons).