How To Install Docker On Windows Nano Server Container Host

After my previous article were I had showed how to Install and configure a Nano Server as a Container Host, In this article I’ll show you how I Install the Docker engine and run Docker commands In a Nano Server Container host.

Before you start first follow the article to configure a Nano Server as a Container host.

In order to run Docker commands on a Nano Server Container Host we need a management machine that will send the Docker commands to the Nano Server, the management server can be a Windows 10 or a Windows Server 2016.

To get started from a management machine download the dockered.exe daemon using the cmdlet below:

Invoke-WebRequest https://aka.ms/tp5/b/dockerd -OutFile .\dockerd.exe

When done, Copy the downloaded Docker file (dockerd.exe) and copy It to the Nano Server c:\windows\system32 folder.

Connect to you Nano Server and Install the Docker daemon

dockerd.exe --register-service

Next Start the Docker service

Start-service docker

To connect to the Docker Daemon from the remote machine we need to create a JSON file and all the ACL to it.

First create a JSON file on the Nano Server using:

new-item -Type File c:\ProgramData\docker\config\daemon.json

Open the file and copy the below code to it and Save

{

"hosts": ["tcp://0.0.0.0:2375", "npipe://"]

}

restart-Service docker

From the management server Install the Docker Client using the cmdlet below:

Invoke-WebRequest https://aka.ms/tp5/b/docker -OutFile $env:SystemRoot\system32\docker.exe

To run the Docker cmdlets disable the firewall first otherwise the Nano Server will block the connection.

Once the Docker client Is Installed you can run remote commands on the Nano Server container Host using:

docker -H tcp://192.168.0.50:2375 images

A better option Is to save the container Host details In a variable and run commands without the -H switch:

$env:DOCKER_HOST = "tcp://192.168.0.50:2375"

Once the variable Is saved you can simply run cmdlets (note that the variable will have cleared when you exit the console)

Docker images

To create a new container type:


Posted

in

, ,

by