When building a docker image you normally use docker build .
.
But i\'ve found that you can specify --pull
, so the whole command would look like
Docker allows passing the --pull
flag to docker build
, e.g. docker build . --pull -t myimage
. This is the recommended way to ensure that the build always uses the latest container image despite the version available locally. However one additional point worth mentioning:
To ensure that your build is completely rebuilt, including checking the base image for updates, use the following options when building:
--no-cache
- This will force rebuilding of layers already available.
The full command will therefore look like this:
docker build . --pull --no-cache --tag myimage:version
The same options are available for docker-compose
:
docker-compose build --no-cache --pull