Enterprise servers are not always exposed to the internet and are often sitting behind firewalls with restrictions to prohibit any malicious activity on an internet-facing server. But to install a Docker image from the Docker Hub, you need internet access. To overcome this, you can configure a Docker client to use a proxy server if one is available, but there is another way around this, which we will discuss in the following high-level steps.

Install Docker with internet access

Log in to a Windows 10 machine that has internet access, probably your laptop or workstation, and use the following URL for instructions to install Docker on Windows 10.

Once the installation is complete, run a PowerShell console and verify the Docker installation on Windows 10:

docker --version
Get-Service *docker*
Verify the Docker installation

Verify the Docker installation

Pull the image from the Docker Hub and export it

Now use Docker to download or pull a Docker test image from the Docker Hub. We'll later use this image to test a Docker installation on Windows Server 2016.

docker pull hello-world:nanoserver-sac2016

After downloading the image, use the docker save command to export and save the image to a file ("nano.tar" for example).

docker save -o nano.tar hello-world:nanoserver-sac2016

This will save the image as "nano.tar" in your current working directory.

Download Docker Enterprise

Now that we have a Docker image, let's use PowerShell to download "Docker Enterprise Edition" to our local workstation as a zip file. We will need this because we don't have internet access on Windows Server 2016.

$URL = 'https://download.docker.com/components/engine/windows-server/17.06/docker-17.06.2-ee-16.zip'

invoke-webrequest -UseBasicparsing -Outfile docker-17.06.2-ee-16.zip -Uri $URL

We can now copy the two files: Docker Enterprise Edition for Windows Server 2016 as a zipped file and a test Docker image we have saved as "nano.tar" in the previous step to the target Windows 2012 Server.

Install Docker Enterprise on Windows Server 2016

Let's switch to the Windows 2012 Server and assume you have placed the Docker Enterprise installation files and the image on D:\. So the first step required is installing the container feature on the Windows 2012 Server and then rebooting the machine when prompted.

# Install Docker
Install-WindowsFeature containers | Out-Null

Once the machine is up and running again, launch a PowerShell console. Then unzip the compressed file and move the Docker executables to the system's program files.

# cd <path to the zip file and docker image>
cd d:\

# Extract the archive.
Expand-Archive docker-17.06.2-ee-16.zip -DestinationPath $Env:ProgramFiles  Force

Next, use the following PowerShell commands to add the Docker folder location to the system's PATH variable and run the Docker executable as a service.

# Add Docker to the path for the current session and to PATH to persist across sessions.
$env:path += ";$env:ProgramFiles\docker"

$newPath = "$env:ProgramFiles\docker;" +
[Environment]::GetEnvironmentVariable("PATH",
[EnvironmentVariableTarget]::Machine)

[Environment]::SetEnvironmentVariable("PATH", $newPath,
[EnvironmentVariableTarget]::Machine)

# Register the Docker daemon as a service.
dockerd --register-service

# Start the Docker service.
Start-Service docker
Set up the PATH variable and Docker service

Set up the PATH variable and Docker service

This will complete the Docker Enterprise setup on Windows Server 2016.

Load and run the image

From the PowerShell console, use the docker load command to load the "nano.tar" file (the Docker image) into our current session. Verify the image is loaded and available and the Docker service is running.

# docker load image offline
docker load -i nano.tar

# list all available images
docker images

# make sure docker service is running
Get-Service *docker
Load the Docker image

Load the Docker image

Now run the test container image using the docker run command. If you get results like in the following screenshot, this means installation was successful and the container is running properly.

Subscribe to 4sysops newsletter!

# run the test container
docker run hello-world:nanoserver-sac2016
Run test containers

Run test containers

Conclusion

Downloading Docker container images from the Docker Hub or Registry is often restricted on enterprise servers. One workaround is to set up a proxy server to allow such access. But in case this is not available or allowed, you can pull and save a Docker image to a machine (Windows 10) that has internet access. Later, you can export the image as a compressed file and move it to the enterprise server (Windows Server 2016) that cannot access the internet. Once you have the image as a compressed file, you can directly load it using the docker load -i <image file name> command on Windows Server 2016 and run containers with the image.

avataravatar
2 Comments
  1. DHARAV PATEL 4 years ago

    Hi,

    I installed docker ce on windows server 2016. It was up and running. A team member installed

    visual studio (offline) using this link and  re-booted the server. Now docker throws following error:

    ./start.ps1 :

    Installing/Updating IBM Planning Analytics Docker images
    Loading image file D:\paw\images\images.tar, this may take a while…
    Something went wrong at step ‘Installing/Updating IBM Planning Analytics Docker images’
    re-exec error: exit status 1: output: ProcessBaseLayer \\?\C:\ProgramData\docker\windowsfilter\c8b41fca42a2fd7b804a3cf54
    ef2e26a28cee52ab1a0f05ffe16fc7caba2763e: The parameter is incorrect. 

    PS C:\Windows\system32> cd d:/paw
    PS D:\paw> scripts/paw.ps1
    Adding custom certificate authority certificates to the system.

    Unable to find image ‘pa-docker:6000/planninganalytics/ibm-java8:latest-windowsservercore’ locally
    C:\Program Files\docker\docker.exe: Error response from daemon: Get https://pa-docker:6000/v2/: proxyconnect tcp: dial t
    cp [::1]:80: connectex: No connection could be made because the target machine actively refused it.
    See ‘C:\Program Files\docker\docker.exe run –help’.
    Adding certificate authority certificate ‘applixca.pem’ to cacerts
    Execution failed with exit code 1
    At D:\paw\scripts\init.ps1:58 char:13
    + throw “Execution failed with exit code $LASTEXITCODE”
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (Execution failed with exit code 1:String) [], RuntimeException
    + FullyQualifiedErrorId : Execution failed with exit code 1

    PS C:\Windows\system32> docker version
    Client:
    Version: 18.09.3
    API version: 1.39
    Go version: go1.10.8
    Git commit: 142dfcedca
    Built: 02/28/2019 06:33:17
    OS/Arch: windows/amd64
    Experimental: false

    Server:
    Engine:
    Version: 18.09.3
    API version: 1.39 (minimum version 1.24)
    Go version: go1.10.8
    Git commit: 142dfcedca
    Built: 02/28/2019 06:31:15
    OS/Arch: windows/amd64
    Experimental: false

    PS D:\paw> docker ps -l
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    – no containers

    Any suggestion to fix this issue

  2. Jon 3 years ago

    if you modify base image.. time to start again from scratch.

Leave a reply

Please enclose code in pre tags

Your email address will not be published.

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account