Deploying Docker Images in an Offline Environment: A Step-by-Step Guide
This guide explains how to pull, export, transfer, import, and run Docker images without network access by using two servers, illustrating the process with the nginx:1.21.6 image and detailed Docker commands.
1. Introduction
In environments without internet connectivity—such as isolated corporate networks or highly secure internal systems—deploying Docker images requires an offline workflow. This article demonstrates how to handle Docker image deployment without network access.
2. Preparation
Two servers are used: Server A holds the original Docker image, and Server B is the target machine where the application will run. The example uses the nginx:1.21.6 image.
3. Server A
3.1 Pull the original image
On Server A execute: docker pull nginx:1.21.6 List images to verify:
docker images3.2 Export the image
Export the image to a tar file using docker save: docker save -o nginx-1.21.6.tar nginx:1.21.6 This creates nginx-1.21.6.tar.
4. Server B
4.1 Transfer the tar file
Copy nginx-1.21.6.tar from Server A to Server B (e.g., to /var/local/).
4.2 Import the image
On Server B load the image with: docker load -i nginx-1.21.6.tar Verify the import: docker images You should see nginx:1.21.6 listed.
4.3 Run the container
Start a container to confirm the image works:
docker run --name nginx-test -p 10000:80 -d nginx:1.21.6Access the service at http://192.168.88.131:10000/.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Selected Java Interview Questions
A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
