Best practices for using docker in an air-gapped e

2020-05-28 23:18发布

问题:

I'm new to Docker, and would like to use it in an air-gapped environment. I understand I can set up my own repository inside my isolated system, but I don't know how to get the many docker images I need from the docker hub into the environment. If I could download them to a .zip or .tgz archive, that would be great, but don't see a way to do that from the hub. I can't use Docker outside the isolated environment. I may be able to use git outside my air-gapped environment, but getting .zip archives would be much better. Advice on how to get started will be appreciated.

回答1:

You can do the following to produce an archive file for any image on the Hub:

docker pull image:tag
docker save image:tag -o file.tar

Then transfer file.tar to the air-gapped machine and just do:

docker load -i file.tar

If you actually have an air-gapped network, rather than a single machine, it's probably a better idea to set up your own registry within the network that contains your curated images.