Skip to content

Instantly share code, notes, and snippets.

@kebyn
Forked from mathewdgardner/docker-save-load-images.sh
Last active September 19, 2019 02:31
Show Gist options
  • Save kebyn/1d394b5b1187c49dbdc55d685f3c26fa to your computer and use it in GitHub Desktop.
Save kebyn/1d394b5b1187c49dbdc55d685f3c26fa to your computer and use it in GitHub Desktop.
Save / load compressed docker images
#!/bin/bash
# Save docker images
ds() {
docker images --format {{.Repository}}:{{.Tag}} | xargs -t -n 1 -I {} -P 4 sh -c 'docker save {} > $(echo "{}" | sed "s/^.*\///").tar.gz'
}
# Load docker images
dl() {
ls *.tar.gz | xargs -t -n 1 -I {} -P 4 sh -c 'docker load -i {}'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment