如果我执行docker-compose pull,是否可以跳过使用docker-compose build --no-cache?

时间:2018-06-28 01:06:30

标签: docker docker-compose

是否会使用docker-compose build --no-cache消除对docker-compose pull的使用?

1 个答案:

答案 0 :(得分:1)

否,但是如果您希望拉动始终发生,请在下面使用

docker-compose build --pull --no-cache

如果您只想进行一次拉动,则docker-compose build将在图像不存在时自动拉动

查看帮助

$ docker-compose build --help
Build or rebuild services.

Services are built once and then tagged as `project_service`,
e.g. `composetest_db`. If you change a service's `Dockerfile` or the
contents of its build directory, you can run `docker-compose build` to rebuild it.

Usage: build [options] [--build-arg key=val...] [SERVICE...]

Options:
    --compress              Compress the build context using gzip.
    --force-rm              Always remove intermediate containers.
    --no-cache              Do not use cache when building the image.
    --pull                  Always attempt to pull a newer version of the image.
    -m, --memory MEM        Sets memory limit for the build container.
    --build-arg key=val     Set build-time variables for services.