This week I am over at our VMware HQ in Palo Alto. I caught up with the guys in our storage team who are working on our docker volume driver for vSphere to find out what enhancements they have made with version 0.7. They have added some cool new enhancements which I think you will like.

First, this has been designed specifically for docker version 1.12. So the first thing you will have to do is to make sure that your docker is at this latest version. For most distros, this is quite a simple thing to do. But since I predominantly use our Photon OS distro, which ships with docker version 1.11 currently, there are a few additional steps to consider. To update the version of docker on Photon OS, you can use the following steps:

Step 1. Make a backup of /etc/yum.repos.d/photon-dev.repo and then add the following stanza of text to the original:

[photon-dev] name=VMware Photon Linux Dev(x86_64) baseurl=https://dl.bintray.com/vmware/photon_dev_$basearch gpgkey=file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY gpgcheck=1 enabled=1 skip_if_unavailable=True

Step 2. Run the following command to update docker:

tdnf install --refresh docker

Step 3. Make a backup of /usr/lib/systemd/system/docker-containerd.service and the edit the original to modify the “ExecStart” section. Replace it with the following:

ExecStart=/usr/bin/docker-containerd --listen unix:///run/containerd.sock --runtime /usr/bin/docker-runc --shim /usr/bin/docker-containerd-shim

Step 4. Run the following commands:

systemctl daemon-reload systemctl restart docker

Step 5. Verify that the docker version is at v1.12 and is functioning:

docker –v docker ps docker volume ls

OK. Now I can proceed with the installation of docker volume driver version 0.7.

The installation process is still the same as before. There are two components; the VIB and the RPM. You need to install the VIB on the ESXi host, and you need to install the Guest OS component as well. The binaries are available for download on github to get you started quickly. But you can also built it yourself. This time I pulled down the latest build from github to my Photon OS VM using “git clone”, and I built the components on my Photon OS. If you want to do the same on your Photon OS, here are the steps:

Step 1. Install git using the following command

tdnf install git

Step 2. Clone the docker volume driver repo

git clone https://github.com/vmware/docker-volume-vsphere.git

Step 3. Install the make utility

tdnf install make

Step 4. Make sure docker is running in Photon OS. The build steps uses docker.

systemctl start docker systemctl enable docker

Step 5. Build the code

cd docker-volume-vsphere/ make

Step 5. Install the RPM on Photon OS

cd build rpm -ivh docker-volume-vsphere-0.7.8d42baa-1.x86_64.rpm

Step 6. restart docker

systemctl restart docker

Step 7. Copy the VIB to the ESXi host on which your Photon OS resides, and install it. The following command is run from the ESXi host, not the Photon OS, after the VIB was copied from the build folder on my Photon OS guest to the /scratch/downloads on the ESXi host:

esxcli software vib install -d \ /scratch/downloads/vmware-esx-vmdkops-0.7.8d42baa.zip \ --no-sig-check -f

Now we can look at some of the enhancements in this newer version. First, there are some new field in the volume view from the ESXi host. Here is how things used to look in the previous version of the driver:

This is how they look now, with the additional fields:

There are a few new fields such as filesystem type, access mode and attachment mode. I’ll discuss these in just a moment.

There are some nice new enhancements to the “docker volume create” commands from within the Guest OS too. There is now a much nicer and more comprehensive help output if you make a typo/mistake. For example:

root@photon [ ~ ]# docker volume create -d vmdk \ -o bad_opt=bad_val Error response from daemon: create .....: Valid options and defaults: [('size', '100mb'), ('vsan-policy-name', '[VSAN default]'), ('diskformat', 'thin'), ('attach_as', 'independent_persistent')] root@photon [ ~ ]#

There are a few things to highlight here.

You can now select which filesystem to place on the volume, so long as the Guest OS supports it. This defaults to “ext4”. You can create Thin, LazyZeroedThick or EagerZeroedThick volumes. This defaults to thin. You can specify a VSAN policy, which I highlighted in a previous post here. If you do not specify a policy when creating volumes on VSAN, it uses the default policy. You can attach volumes as independent persistent, meaning that they can now be snapshot’ed for the purposes of backup. More on disk formats can be found here. The default is independent_persistent, meaning that no snapshot is created during backups, meaning that this volume is not backed up.

So lets create some new volumes for containers from my Photon OS Guest OS. I will create 3 volumes in total, with different specifications.

Volume 1 – Create a volume that is on the same datastore as my Photon OS VM, with a size of 10GB (which is a VSAN datastore by the way). Everything is default.

root@photon [ / ]# docker volume create --driver=vmdk \ --name=testvol1 -o size=10gb testvol1