Skip to content

Instantly share code, notes, and snippets.

@simbamangu
Last active February 21, 2023 17:03
Show Gist options
  • Save simbamangu/a0c674660b192c1bd79fb22ea93dd6a6 to your computer and use it in GitHub Desktop.
Save simbamangu/a0c674660b192c1bd79fb22ea93dd6a6 to your computer and use it in GitHub Desktop.

After another Docker pull losing connection partway through a download (95% of 12GB this time), I spun up a virtual machine in the cloud and did the pull there, followed by docker save and downloading locally - this allows for a resumable download over SSH.

Overview:

  1. Set up cloud machine with either password or SSH key access (key access example below).
  2. Install docker
  3. docker pull the image
  4. docker save the image as compressed image using gzip
  5. Download with rsync

After installing Docker, here's an example using hello-world on the virtual machine:

docker pull hello-world
docker save hello-world | gzip > hello-world.tar.gz

Then, from your home machine:

rsync -P -z -e "ssh -i [SSHKEY]" USER@SERVER:~/hello-world.tar.gz ~/Downloads/hello-world.tar.gz
docker load < ~/Downloads/hello-world.tar.gz

rsync may be cancelled with ctrl-c, and if cancelled or otherwise failing can be resumed with the same command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment