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

Ana*_*gha 4 docker docker-compose

使用 docker-compose build --no-cache 会消除 docker-compose pull 的使用吗?

Tar*_*ani 5

不,但如果您希望拉动始终发生,请使用下面的

docker-compose build --pull --no-cache
Run Code Online (Sandbox Code Playgroud)

如果您只想要一次拉取,那么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.
Run Code Online (Sandbox Code Playgroud)