What is the difference between `docker-compose build` and `docker build`?

前端 未结 5 1640
日久生厌
日久生厌 2020-12-23 03:11

What is the difference between docker-compose build and docker build?

Suppose in a dockerized project path there is a docker-compo

5条回答
  •  执笔经年
    2020-12-23 03:26

    Basically, docker-compose is a better way to use docker than just a docker command.

    If the question here is if docker-compose build command, will build a zip kind of thing containing multiple images, which otherwise would have been built separately with usual Dockerfile, then the thinking is wrong.

    Docker-compose build, will build individual images, by going into individual service entry in docker-compose.yml.

    With docker images, command, we can see all the individual images being saved as well.

    The real magic is docker-compose up.

    This one will basically create a network of interconnected containers, that can talk to each other with name of container similar to a hostname.

提交回复
热议问题