Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I skip using docker-compose build --no-cache if I do a docker-compose pull?

Would using docker-compose build --no-cache eliminate the use of docker-compose pull?

like image 727
Anagha Avatar asked Oct 30 '25 09:10

Anagha


1 Answers

No, but if you want the pull to happen always, then use below

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

If you just want a single pull then docker-compose build will do auto pull if the image doesn't exists

See the help for same

$ 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.
like image 186
Tarun Lalwani Avatar answered Nov 01 '25 06:11

Tarun Lalwani