Skip to content

Instantly share code, notes, and snippets.

@tronyx
Created May 11, 2018 14:08
Show Gist options
  • Save tronyx/9496615e4a3b88d22eb2e9bbf16cc597 to your computer and use it in GitHub Desktop.
Save tronyx/9496615e4a3b88d22eb2e9bbf16cc597 to your computer and use it in GitHub Desktop.
Basic script to detect and update active Docker container images
docker ps -aq > docker_ids.txt
while read CONTAINER
do
docker inspect ${CONTAINER} |grep -v sha |grep Image |awk '{print $2}' |tr -d '",'
done < docker_ids.txt > docker_images.txt
while read IMAGE
do
docker pull ${IMAGE}
done < docker_images.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment