- Create a custom role with Azure role-based access control (Azure RBAC) using PowerShell - Wed, Jan 20 2021
- Step by step Deploying Docker Container to Azure using Azure CLI - Wed, Sep 2 2020
- Install Docker offline on Windows Server 2016 - Thu, Dec 6 2018
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*
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
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
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
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.