How to install a Docker image without network access
Published
Updated
In some situations, you may have a server that may be behind a corporate firewall or doesn’t have the correct proxy configuration needed to download the requisite files from Docker Hub in order to build your Docker image. To solve this, you have to options:
- Correct the proxy configuration settings and open the firewall to allow outbound connections
- Build the Docker image on a computer or server which DOES have network access and transfer it.
In this guide, I will show you the latter, how to build a Docker image on a host that has network access and then transfer that image to a server that may not have the requisite network access.
For the sake of example, I will show you how to do this with a Redhat Linux image. First, pull down the image you require:
docker pull registry.access.redhat.com/rhel7
Then you can simply save this image to a Dockerfile with the following command:
docker save -o rhel7.docker registry.access.redhat.com/rhel7
Transfer this image over to the network-less server via SCP or a USB drive if necessary and import it using the following command:
sudo docker load -i rhel7.docker
The image will now be imported on the server without having to connect to the destination Docker registry.