Docker Machine with VMware Player

The purpose of this tech article is to describe the process used to get a docker machine working on Windows 10, using VMware as the Hypervisor.

Some may think why on earth would you do this given that we now have an official Docker for Desktop release that does it all for you…and if you weren’t keen on using that, then you have the legacy Docker Toolbox that also does something similar.

Well, for a start, I didn’t want to use Hyper-V as a Hypervisor (this is the default used by the official Docker for Desktop install). I also didn’t want to use Docker ToolBox because that in itself uses Oracle Virtual Box as a Hypervisor.

I wanted to use the free (not paid) version of VMware Workstation (Player) and just “mess” with it and have some fun.

VMware Workstation Player & VMware-VIX

Configure VMWare VIX

<InstallParentDir>\VMwareVIX\vixwrapper-config.txt and add the following line as shown:

# Workstation 14.0.0
ws 19 vmdb 14.0.0 Workstation-14.0.0
player 19 vmdb 14.0.0 Workstation-14.0.0
player 19 vmdb 15.1.0 Workstation-14.0.0
# latest un-versioned
ws 19 vmdb e.x.p Workstation-14.0.0
player 19 vmdb e.x.p Workstation-14.0.0

Download VMware Disk Utility

<InstallParentDir>\VMwarePlayer\vmware-vdiskmanager.exe

Set Permissions

<InstallParentDir>\VMware\VMwarePlayer\vmplayer.exe
<InstallParentDir>\VMware\VMwarePlayer\vmware-vdiskmanager.exe
<InstallParentDir>\VMwareVIX\vmrun.exe

Ensure that the VMwareVIX and VMwarePlayer paths are included in your System Path Environment Variable:

<InstallParentDir>\VMware\VMwarePlayer
<InstallParentDir>\VMwareVIX

Where <InstallParentDir> is the parent directory that contains your installation of Player & VIX. For example, if you have installed to the following directories:

C:\Apps\VMware\VMware Player
C:\Apps\VMware\VMware VIX

Then your System Path Environment would require the following entries to be added:

Image for post
Image for post

Download and Install Docker Binaries

docker-machine.exe/docker.exe

Update System Path

Image for post
Image for post

Download/Install MSYS2

C:\Apps\msys64

Once installed, search for MSYS2 and you’ll be able to launch an MSYS command prompt.

Image for post
Image for post

At the MSYS command prompt, we’ll use the package manager pacman to update MSYS packages as follows:

pacman -Syu

Once the updates are done, enter the following to install make.

pacman -S base-devel gcc

The make.exe binary should now be available at C:\Apps\msys64\usr\bin. We’ll need to add this directory to our System Path environment variable.

Image for post
Image for post

Install SSH Binaries

Git includes OpenSSH binaries which worked out of the box for the setup. The installation wizard for git defaults to target directory C:\Program Files\Git. If we take a look in C:\Program Files\Git\usr\bin after the installation is complete, we’ll see several binaries and amongst them you’ll find an ssh.exe.

We’ll need to add this path (C:\Program Files\Git\usr\bin) to our System Path Environment variables. If we don’t do this, the ssh binary used for subsequent commands will default to the ssh.exe, usually located at C:\WINDOWS\System32\OpenSSH:

Also, when adding the directory C:\Program Files\Git\usr\bin to the System Path environment variable, we need to ensure that this path appears before both the C:\WINDOWS\System32 and C:\Apps\msys64\usr\bin.

Image for post
Image for post
Image for post
Image for post

Restart Powershell Console and check to ensure that the correct location is used for ssh.exe.

Installing and Configuring Golang

Download and Install GO

The installer also adds an entry for c:\Go\bin directory in your System PATH environment variable. The default workspace is set by the installer in your User environment variables as:

GOPATH = %USERPROFILE%\go

We will need to create the above directory. The installer did not create it for us.

PS C:\> mkdir “$env:userprofile\go”

Test GO Installation

Compile/Build:

Run the hello binary:

A “hello, world” message should be displayed. This indicates that Go has been installed and configured successfully.

Download dep (Dependency Manager for GO)

Modifying the VMwareWorkstation Driver

  • Download Driver Repo to Local GO Workspace:
$env:Gopath\src\github.com\pecigonzalo\docker-machine-vmwareworkstation\vmrun.go
  • Edit the following files that are now in the local repo, located at:

$env:Gopath\src\github.com\pecigonzalo\docker-machine-vmwareworkstation

vmrun.go:

$env:Gopath\src\github.com\pecigonzalo\docker-machine-vmwareworkstation\vmrun.go

workstation.go:

Change all occurrences of "nogui" to "gui"

vmx.go:

$env:Gopath\src\github.com\pecigonzalo\docker-machine-vmwareworkstation\vmx.go

vmrun.go:

$env:Gopath\src\github.com\pecigonzalo\docker-machine-vmwareworkstation\vmrun.go

Compile the Driver

Compile vmwareworkstation driver

After the compile is complete, the compiled binary will be located at:

Copy the driver exe over to C:\Apps\docker:

Testing the New Version of the Driver

Create Docker Machine

Using a powershell prompt (as admin):

Create Docker Machine using the New Driver

Check the Machine Status

Check Status of Docker Machine

Working with the Docker Machine

The command in the last line of the above output needs to be executed so that our shell environment can communicate with the docker machine host.

Hello World Docker

Run hello-world docker image

Written by

Primarily a Learner/Coder with interests in Python, Cloud Technologies, Security and Automation. Pandas munching on Bamboo sticks give me the “Giggles” :))

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store