Delen via


Docker in Azure VM

Getting started in a new technology can be frustrating when things go wrong, and Docker is no exception. The purpose of this post is to highlight some common issues faced when getting started with Docker in Azure.

Choose the right VM for the job

It is hard to put into words regarding the feeling you get when you provision a new VM, enable Hyper-V, download Docker, install Docker and then receive a 0xc0351000 error when running Hello-World:

C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: container 6cc2e3a20dcc82e47fd223de7b1fc8b8d6fd19a538079b23fde72d9dd441ef74 encountered an error during CreateContainer: failure in a Windows system call: No hypervisor is present on this system. (0xc0351000)  

What! I followed the instructions!

Actually, wait a second... why are not all the options available?

Well, things are obvious in hindsight and it was in the documentation but here is how I missed it. First of all, I skipped the documentation and went strait to provisioning a VM. Being on a budget I picked a standard VM. Well, why not? It will save me over $100 a month and the images I am running will be small. Unfortunately, the VM does need to be large enough to support nested virtualization.

This is stated in the documentation How to enable nested virtualization in an Azure VM and the different VMs that support virtualization (Dv3 or Ev3) are listed in the Azure compute unit (ACU) page.

Is your base machine Windows?

When looking at hosting the images, a basic question should be "Can all the images be run on a Unix OS?" At the moment, many of Azure container services only support hosting Unix based images. So, if you building images relying on .Net Framework 3 or 4 images then you're limited primarily to hosting using Azure VMs and Azure Container Services (ACS). Azure Kubenetes Service (AKS) and Web Apps for Containers do not support windows images at the moment.

Watch the build version!

After running Hello-World and various wordpress images, you'll want to run a bespoke image. Great, creating an image using the docker file was not so bad. After pushing the image into a registry and pulling it down on the host VM, the image is run and another error: 0xc0370101 .

C:\Program Files\Docker\docker.exe: Error response from daemon: container de3a7849124fa423870f15e9e668362dae54aeccc539087eb3e79aef1dc75215 encountered an error during CreateContainer: failure in a Windows system call: The operating system of the container does not match the operating system of the host. (0xc0370101)

Containers are not isolated from OS so the OS of the container must match the OS of the container host. Fortunately with Hyper-V, this can be overcome in some circumstances with the parameter  --isolation=hyperv to use Hyper-V isolation .

See Stefan Scherer's post for more explanation and Windows Container Version Compatibility.

Comments

  • Anonymous
    September 10, 2018
    Docker is so sweet when it works, but can be oh so frustrating when it doesn't :)
  • Anonymous
    January 11, 2019
    This is short and sweet. Great article, Chilberto!