Last active
August 1, 2016 07:26
-
-
Save icyleaf/401065674c4d692f4bf4a66101d2f259 to your computer and use it in GitHub Desktop.
Save all docker images to disk & Load archive file to docker.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for file in $(ls *.tar); do | |
echo "load $file" | |
docker load -i $file | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
images = `docker images|grep -v REPOSITORY`.split("\n") | |
images.each do |image| | |
name, version, _id, _date, _size = image.gsub(/\s+/m, ' ').strip.split(' ') | |
filename = "#{name.tr('/', '_')}_#{version}.tar" | |
command = "docker save #{name}:#{version} -o #{filename}" | |
puts command | |
system(command) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment