sudo curl -o /usr/local/bin/docker-load-and-push https://gist.githubusercontent.com/rluvaton/ef6415c79c35c5b11c535040e79ab43b/raw/19cb82651a10d5256f512331b484dee8a19a8058/docker-load-and-push.sh && sudo chmod +x /usr/local/bin/docker-load-and-push
foo@bar:~$ docker-load-and-push --help
This script must be run with Docker capable privileges and you should login to your registry before pushing!
Usage:
./docker-load-and-push.sh [--dir <dir_with_images>] [--file <saved_image>] [--registry <registry-url>] --auto-delete
-h,--help Display this help
-f,--file <saved_image> The image file to load and push
-d,--dir <dir_with_images> The directory containing images file to load and push
[--registry <registry-url>] Push to specific registry
--auto-delete Delete tar file after upload
Example: ./docker-load-and-push.sh /mydir/ubuntu.tar --push --registry
sudo curl -o /usr/local/bin/docker-save-and-retag https://gist.githubusercontent.com/rluvaton/ef6415c79c35c5b11c535040e79ab43b/raw/19cb82651a10d5256f512331b484dee8a19a8058/docker-save-and-retag.sh && sudo chmod +x /usr/local/bin/ docker-save-and-retag
Then use docker-save-and-retag
instead of ./docker-save-and-retag.sh
in examples
Example: Basic usage docker-save-and-retag.sh
./docker-save-and-retag.sh ubuntu:latest /mydir/ubuntu.tar my.private.registry/docker/ubuntu:latest
Example: Save and retag all local images as escaped_image_name.tar
in /path/to/
docker images --format "{{.Repository}}:{{.Tag}}" | while read line ; do ./docker-save-and-retag.sh $line "/path/to/$(echo $line | sed -r 's/[\:\/]+/_/g').tar" "my.private.registry.com/$line" ; done