DEV Community

Discussion on: Update all docker images already pulled.

Collapse
 
nandoabreu profile image
Fernando Abreu

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:

docker images | grep -v ^REPO | sed 's/ \+/:/g' | cut -d: -f1,2 | xargs -L1 docker pull
Enter fullscreen mode Exit fullscreen mode

(my postgres:13-alpine was updated now, to 160MB)

And to clean unused and untaged images after that, run:

docker image prune
Enter fullscreen mode Exit fullscreen mode
Collapse
 
goffity profile image
Goffity Corleone

Thanks, It's very helpful.