9

Is there a command to update (pull) all the downloaded Docker images at once in the terminal ?

3 Answers 3

10

No, there is no built-in command to pull all docker images at once.

But you can try this (multiline) bash using docker --format :

for image in $(docker images --format "{{.Repository}}:{{.Tag}}" | grep -v '<none>')
do
  docker pull $image
done

Or in one line:

for image in $(docker images --format "{{.Repository}}:{{.Tag}}" | grep -v '<none>'); do docker pull $image; done;
0
3

You can use this :

docker images | awk '{print $1":"$2}' | grep -v REPOSITORY | xargs -L1 docker pull 
2

The most "dockerist" way to do it is:

docker images --format "{{.Repository}}:{{.Tag}}" | xargs -L1 docker pull
2
  • While docker image names and tags may not contain blanks, which xargs would then use to split it into multiple arguments, it might still be a good idea to explicit set the line separator \n as the only valid character used for splitting: -d '\n' And while we are at it, also a -r or --no-run-if-empty to not run any command when currently no local image exists. And <none> should be filtered out.
    – pmhahn
    Jan 27 at 7:54
  • Thanks for your comments @pmhahn Think that xargs -d is not available in all *nix systems like FreeBSD. I will keep the answer without your suggestions to have a closer answer to most scenarios. Jan 28 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.