Monday, August 27, 2018
Docker on Ubuntu on Hyper V 2012 R2
Docker on Ubuntu on Hyper V 2012 R2
I recently read through an MSDN article that described running Docker in a VM on Hyper-V.
Frankly, I was less than impressed at the complexity of the solution. Especially since the concept here is not a huge leap.
The basic steps are:
- Build a VM on Hyper-V
- Install Docker into that VM
- Run containers in that VM
- Your Docker containers are isolated within a VM.
The model here is one VM per tenant. Thus forming that boundary and still getting the flexibility of both containers and VMs.
- You can run the OS of your choice.
So, you want to setup Docker in a VM. There are a few steps as I am outlining this in gory detail. Here is goes:
- Install Ubuntu in the VM (14.04 LTS Server) or 14.10
- Add OpenSSH Server
- Determine IP
- Connect over SSH
- Update
- sudo apt-get update
- Upgrade the components (aka patch the OS)
- sudo apt-get upgrade -y
- Add Docker gpg key (that is qO not qZero)
- sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
- Update the app list
- sudo sh -c "echo deb http://get.docker.io/ubuntu docker main >> /etc/apt/sources.list.d/docker.list"
- Update the local apt repository after adding the docker reference
- sudo apt-get update
- Install (latest) Docker (on 12/15/14 this is 1.4.0)
- sudo apt-get install lxc-docker -y
Now you are ready to play with the magic of Containers.