Docker running on VMware VSphere

Posted in , ,   with  No comments     Edit
Vmware has been the big player in the virtualization field for several years, leading in many aspects and also promoting different types of technologies and IT solutions.

After the appearance of docker and several container types of technologies (LXC/LXD, CoreOS, etc), Vmware had to think about how to coexist with this new neighbors and think about how to create a long-term relationship with them.

In this post, I will try to show you how to run Docker inside a Vmware Virtual machine in order to take advantage of nested virtualization and all the benefits of both technologies.

For this entry, I will use as a reference my laptop running Ubuntu 16.10 and a second box running Vmware VSphere 6.


According to Docker's Web Page, Docker Machine is a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with docker-machine commands. You can use Machine to create Docker hosts on your local Mac or Windows box, on your company network, in your data center, or on cloud providers like Azure, AWS, or Digital Ocean.

Using docker-machine commands, you can start, inspect, stop, and restart a managed host, upgrade the Docker client and daemon, and configure a Docker client to talk to your host.

To install this tool in our host, we just need to download it and follow the installation instructions.

We can find the CLI commands for the vmware driver in the following link 

The options used will be:

--vmwarevsphere-username: required vSphere Username.
--vmwarevsphere-password: required vSphere Password.
--vmwarevsphere-vcenter: IP/hostname for vCenter (or ESXi if connecting directly to a single host).

#docker-machine create --driver vmwarevsphere --vmwarevsphere-username=user --vmwarevsphere-password=SECRET  --vmwarevsphere-vcenter ip address vm_name

For the purpose of this post, we will use default values for VM disk size, virtual cpus and memory allocation.

--vmwarevsphere-memory-size = default value 2GB
--vmwarevsphere-cpu-count = default 2  vcpus
--vmwarevsphere-disk-size = default 20gb

What we do with this instruction, is to install a lightweight Linux distro called Boot2Docker , that has already installed docker on top of it.

So i ran the following command

rmondion@E570ubuntu:~$ docker-machine create --driver vmwarevsphere --vmwarevsphere-username=root --vmwarevsphere-password=mypasword --vmwarevsphere-vcenter vmtest

Running pre-create checks...
Creating machine...
(vmtest) Default Boot2Docker ISO is out-of-date, downloading the latest release...
(vmtest) Latest release for github.com/boot2docker/boot2docker is v17.09.0-ce
(vmtest) Downloading /home/rmondion/.docker/machine/cache/boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v17.09.0-ce/boot2docker.iso...
(vmtest) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
(vmtest) Copying /home/rmondion/.docker/machine/cache/boot2docker.iso to /home/rmondion/.docker/machine/machines/vmtest/boot2docker.iso...
(vmtest) Generating SSH Keypair...
(vmtest) Creating VM...

Everything was looking fine when I got this error

Error creating machine: Error in driver during machine creation: ServerFaultCode: Current license or ESXi version prohibits execution of the requested operation.

Looking for some information about this issue I found this link. According to this, the tool communicates directly with VCenter to create the Virtual Machine and not with the ESxi host. In my case I have not installed this management tool, so won't be able to continue with this process.


We can see that from docker-machine command, a small Linux distro (in our case Boot2Docker), it's installed in a brand new virtual machine, this VM will be hosting our container images

We can find several Linux distributions that can be chosen for running Docker. I think one of the things that we need to search in our implementation scheme, is to keep a lightweight OS, installing just the necessary software to run Docker.

There're several small Linux distros, used for this purpose that I will mention right now:


This is a pretty small distro (106 MB), and offers a basic functionality. It's often used in docker containers and we can find a lot of Docker images based on this distro in the Docker Marketplace.


Ubuntu offers a minimal iso (58 MB), that install the minimal packages and offers a netinstall installation to install more software if required.


From the installation wizard, we can choose to install the minimal version, you can find here a small tutorial


Like the Centos OS, you can download the DVD image and choose server or minimal installation, you can find here also a tutorial for this purpose.

Once we have installed our Linux Distro, we can install Docker, either from a repository (yum, apt-get, zypper, etc), or download the binary from the Docker Web page.


This Linux distribution it's an initiative from VMware, to build a Docker ready OS. More details about this distro can be found here.

It offers several ways to install (as an ISO, OVA file, etc).

From PHOTON OS web page:

Photon OS™ is a minimal Linux container host, optimized to run on VMware platforms. With the 1.0 release, we have greatly expanded the library of packages that are in our repository, making Photon OS™ more broadly applicable to a range of use-cases. We invite partners, customers, and interested community members to collaborate on both running containerized applications in a virtualized environment and the potential of an operating system tightly coupled to underlying virtual infrastructure.

We will import the ova file (Photon OS, Version 1.0 - OVA with virtual hardware v11) to our VSphere environment and will give a quick test.

We go to Create VM --> Select creation type --> Deploy VM from ova/ovf file

We choose a name and the ova file

We complete selecting the datastore and accepting VMware license.

Once we have completed the info we are ready to deploy and finish installation

The process takes a couple of minutes and we can see that our VM is active and that we can access to console.

We use the default credentials for the first login (user: root, pass: changeme) and the system will ask to change the default password

By default the docker service is not enabled, so we need to enable it.

We saw right now how to install docker inside a VM, in our case using a project sponsored by VMware.


- There're several ways to install docker inside VMware VSphere, we can choose a sponsored solution by the same company like Photon OS, or choose our favorite Linux distribution, install from scratch and then install docker on top of it.

- docker-machine is a helpful tool, but in the case of the VMware driver, we must consider that the vCenter solution must be installed in order to be able to communicate with the tool.

- There are other solutions like Photon, that provides a docker ready OS, such as Rancher OS or Atomic Project, that you can take a look too. I will try to write some posts about this appliances too.

- Here's an interesting post about container ready OS, that will be complementary to this article.

Thanks for visiting !!!!



0 comentarios:

Post a Comment