Created
December 25, 2024 01:41
-
-
Save 0x77dev/ff8799070fc4a6066c065dac122eb317 to your computer and use it in GitHub Desktop.
Transferring Docker images offline
This file contains hidden or 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 image in (docker image ls --format json | jq -r .Repository) | |
| docker save $image > /tmp/images/(echo $image | string replace -a "/" "-").tar & | |
| end |
This file contains hidden or 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 image in (ls /tmp/images) | |
| echo Loading /tmp/images/$image | |
| docker image load -i /tmp/images/$image & | |
| end |
This file contains hidden or 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
| ssh remote@host docker image save $TAG | docker image load |
This file contains hidden or 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
| 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