Share via


Setting up windows containers offline

*** Please note that this post is meant for dev environments and not for production scenarios ***

Containers and Serverless are all the rage these days, but many enterprise developers do not have internet access on their development VMs. So how do we get started?

To setup windows containers on your machine, you would need few things:

  1. The 'containers' feature to be enabled on your server
  2. The Docker tooling – the Docker client and the Docker engine [Needs Internet access]
  3. The container images themselves [Needs Internet access]

What we can do, in this case, is to use a machine that has internet access and download the required components. Great, but how does it work for container images?

Let's go step-by-step:

On a machine with internet access (I am going to assume a Windows server 2016 standard/datacenter or Windows 10 anniversary/creators update):

  1. Open powershell and install the containers feature. Once completed, restart the machine

    Install-WindowsFeature Containers

  2. Download the Docker community edition package from here (pick whichever version you need. As an example - docker-17.09.0-ce.zip). Note that we are using the community edition here and not the enterprise edition of Docker.

  3. Extract the contents to C:\ProgramFiles\docker and add that path to the environment variables

  4. Register dockerd as a service and start it

    dockerd.exe --register-service

    Start-Service docker

  5. Pull the images that you want to play with, let's say windowsservercore (ver 1709) and aspnetcore

    docker pull microsoft/windowsservercore:1709

    docker pull microsoft/aspnetcore

  6. Once the download is complete, you can export the images in a tar format, which can then be copied to another machine. Note that the save operation takes time and is based on the size of the image.

    docker save -o c:\windowsservercore1709.tar microsoft/windowsservercore:1709

Now, on the server with no internet access:

  1. Open powershell and install the containers feature. Once completed, restart the machine

    Install-WindowsFeature Containers

  2. Get the docker package you downloaded from Step #2 and perform Steps #3 and #4

  3. Get the exported images (from Step #6) locally and load them

    docker load -i c:\windowsservercore1709.tar

We are now ready to play with containers. To setup an orchestrator, like miniKube follow the detailed instructions here.

Have fun!