Configuring Nano Server For Remote Connections

Here, we are going to connect with the Docker engine remotely using PowerShell. For this, we can either use our local machine or a VM. Before we proceed further, make sure that your Nano Server is up and running.

Step 1 Downloading the Docker Daemon and extracting them

  • Create a variable that references the zip file which is in the official docker website. This zip file will have the Docker engine data that is required to create the client and server. Open the PowerShell with administrator privileges and run the below given command.

    This will assign the link to that variable named,

    $package = "https://download.docker.com/components/engine/windows-server/cs-1.12/docker.zip"
  • The next step is to invoke a web request to get the link that has been referenced in the variable called. Then, the file will be stored in a temporary storage by getting downloaded from the Docker site. For this, we have to run the following command.

    Invoke-WebRequest $package ` -OutFile "$env:TEMP\docker.zip" ` -UseBasicParsing
  • Now, we shall expand the downloaded zip file to the programming files of our machine. For this, run -

    Expand-Archive -Path "$env:TEMP\docker.zip" `
    -DestinationPath $env:ProgramFiles
  • The final step is to create an environment variable that will add the Docker directory to the path daemon. Run the command

    [Environment]::SetEnvironmentVariable("Path", $env:Path + ";$($env:ProgramFiles)\Docker", [EnvironmentVariableTarget]::Machine)

    Nano Server
  • Now, we have finished installing the Docker (client) and Dcokerd (engine) in "Program Files" folder. Check for these inside the Docker folder.

    Nano Server

Step 2 Creating Environment variable to connect Docker easily

  • Here, Docker is client and Dockerd is engine. Now, we are going to configure an environment variable that will store the DNS name of our Nano Server and connect with it. For this, run the below command.

    [Environment]::SetEnvironmentVariable("DOCKER_HOST","nanoserver007.southindia.cloudapp.azure.com",[EnvironmentVariableTarget]::Machine)

    Note - Replace the DNS name with your Nano Server DNS or IP.
  • Now, open the new PowerShell console and run the command "docker version" . This will show you the client (Docker) and engine (Dockerd). This means we have created a connection in between these two services which we have actually downloaded from the Docker website.

Up Next
    Ebook Download
    View all
    Learn
    View all