Skip to content

Instantly share code, notes, and snippets.

@0x77dev
Created December 25, 2024 01:41
Show Gist options
  • Save 0x77dev/ff8799070fc4a6066c065dac122eb317 to your computer and use it in GitHub Desktop.
Save 0x77dev/ff8799070fc4a6066c065dac122eb317 to your computer and use it in GitHub Desktop.
Transferring Docker images offline
for image in (docker image ls --format json | jq -r .Repository)
docker save $image > /tmp/images/(echo $image | string replace -a "/" "-").tar &
end
for image in (ls /tmp/images)
echo Loading /tmp/images/$image
docker image load -i /tmp/images/$image &
end
ssh remote@host docker image save $TAG | docker image load
I had a scenario where I needed to transfer Docker images from one machine to another using a removable drive.
There was no internet access, no registry, no LAN, and no SSH available.
These snippets allow you to dump all images from Docker on one machine and load them onto another.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment