Skip to main content

Shell command to update all local Docker images already pulled.

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

# And to clean unused and untaged images after that, run (--force, will not prompt for confirmation):
docker image prune --force

# All-in-one function
function docker_update_all_images {
    docker images | grep -v REPOSITORY | awk '{print $1":"$2}' | xargs -L1 docker pull

    # Remove untagged images
    docker image prune --force
}