Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference b/w a docker image generated by docker-compose build vs docker build?

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?

like image 589
Sid Patel Avatar asked Mar 03 '16 18:03

Sid Patel


People also ask

What's the difference between docker build and docker compose?

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.

Does docker compose create a docker image?

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.

What is a docker compose image?

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.


1 Answers

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.

like image 89
Armin Braun Avatar answered Oct 03 '22 16:10

Armin Braun