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

前端 未结 5 1682
日久生厌
日久生厌 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:25

    Few additional words about the difference between docker build and docker-compose build. Both have an option for building images using an existing image as a cache of layers.

    • with docker build, the option is --cache-from
    • with docker-composer, there is a tag cache_from in the build section.

    Unfortunately, up until now, at this level, images made by one are not compatible with the other as a cache of layers (Ids are not compatible). However, docker-compose v1.25.0 (2019-11-18), introduces an experimental feature COMPOSE_DOCKER_CLI_BUILD so that docker-compose uses native docker builder (therefore, images made by docker build can be used as a cache of layers for docker-compose build)

提交回复
热议问题