When we want to update all images that pulled. This is a command to use update all images at once. (This command will pull the latest tag)
docker images | grep -v REPOSITORY | awk '{print $1}' | xargs -L1 docker pull
I found this command a long time ago and I cannot remember the reference. I am sorry for the owner.
Edit 2021-12-21
Today I found a problem on MacOS with this command and fixed to use
docker images | grep -v REPOSITORY | awk 'BEGIN{OFS=":"} {print $1,$2}' | xargs -L1 docker pull
Top comments (4)
@goffity the following:
can be easily done with:
So the final command would be:
awesome ()/
That command will update all images, but will pull maybe more than you need. For instance, I use python:3.6-alpine (40MB) and postgres:13-alpine (158MB). That command downloads a new python:latest (880MB) and a new postgres:latest (314MB).
The command to update your existing images is:
(my postgres:13-alpine was updated now, to 160MB)
And to clean unused and untaged images after that, run:
Thanks, It's very helpful.