While building a docker image, image id is different if the image is built using docker-compose build
vs docker build
. The env has different hostname.
What else is different? Why images are different?
Difference between docker-compose and Dockerfile. The key difference between the Dockerfile and docker-compose is that the Dockerfile describes how to build Docker images, while docker-compose is used to run Docker containers.
Define and run multi-container applications with Docker. docker-compose build : This command builds images in the docker-compose. yml file. The job of the build command is to get the images ready to create containers, so if a service is using the prebuilt image, it will skip this service.
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application's services. Then, using a single command, you create and start all the services from your configuration.
There are no differences between the actual image that gets build between docker-compose build
and a "manual" docker build
in terms of the contents of the image.
The difference is only in naming/tagging of the build result, which docker-compose
does automatically for you.
Other than that the docker-compose
build is no different behind the scenes and simply a wrapper for the normal docker build
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With