How to install Docker on Windows Server 2016 without Internet?

3

I'm trying to install docker on a Windows Server 2016 VM that's not connected to the internet. The official docker documentation doesn't give any advice for installing on a Windows Server 2016 VM without the internet, so how can I achieve this?

I read a blog somewhere that said it was sufficient to download the docker.exe and dockerd.exe files and place them in C:\Windows\System32, then running dockerd.exe --register-service was sufficient to install Docker. While this appears to have "worked" (docker info has output), trying to pull down an image from my local registry fails (it just freezes with no error output). Additionally, I notice that there is no DockerNAT NIC setup, and I'm going to guess that there are other steps missing that I'm unaware of.

riqitang

Posted 2018-03-30T13:36:01.500

Reputation: 133

Answers

6

The Docker website actually documented the entire process.

  1. In a PowerShell command prompt, download the installer archive on a machine that has a connection.
invoke-webrequest -UseBasicparsing -Outfile docker-17.06.2-ee-7.zip https://download.docker.com/components/engine/windows-server/17.06/docker-17.06.2-ee-7.zip
  1. Copy the zip file to the machine where you want to install Docker. In a PowerShell command prompt, use the following commands to extract the archive, register, and start the Docker service.
# Extract the archive.
Expand-Archive docker-17.06.2-ee-7.zip -DestinationPath $Env:ProgramFiles

# Clean up the zip file.
Remove-Item -Force docker-17.06.2-ee-7.zip

# Install Docker. This requires rebooting.
$null = Install-WindowsFeature containers

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

# Optionally, modify PATH to persist across sessions.
$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
  1. Test your Docker EE installation by running the hello-world container.
docker container run hello-world:nanoserver

Install Docker Enterprise Edition for Windows Server

Since you failed to provide what version of Windows Server you are using the following information might be relevant.

Docker Universal Control Plane is not currently supported on Windows Server 1709 due to image incompatibility issues. To use UCP, for now, use the current LTSB Windows release and not 1709.

Ramhound

Posted 2018-03-30T13:36:01.500

Reputation: 28 517

There are other steps you must take to run and/or start Docker in a situation where your system is isolated. Your question was specifically on how to install docker, so that is the only part of your problem, I focused on. How you run a Docker container offline is well documented. – Ramhound – 2018-03-30T14:04:39.497

Your answer seems to imply that if I zip up the docker folder that's on my PC, then place it in the Program Files directory on the VM, add the location to the path, then do dockerd --register-service it should work? – riqitang – 2018-03-30T14:06:53.760

1The documentation indicates that. In an attempt to correct the formatting, I mistakenly copied the wrong segment of code, which is the reason I supplied a link to the instructions. You need to run the PowerShell commands in the second part of the process per the documentation. – Ramhound – 2018-03-30T14:11:02.523

Thanks it worked, I was getting confused because it appeared to "freeze" when I tried pulling an image, but turns out it was just going very slowly. I was able to view the slowness by issuing the docker pull command from a remote computer (my PC), which showed the progress more closely than the PowerShell session did. – riqitang – 2018-03-30T21:08:16.050