Create a VirtualBox VM with Docker-Machine

Warning: requires a little bit IT skills

Here we describe steps for creating a VM with the help of docker-machine, within whose docker-engine is installed allowing to install NMRProcFlow in the wake, the whole in a single shell script. We think it might be useful for those who want to create virtual machines on the fly on their desktop / laptop and then clean it up after have done using it.

We have realized the test on Windows 7/10 Pro 64bits/Cygwin, but no doubt this test can be performed on any Linux or Mac OS X 10.11 or higher operating system without changing anything.. For Windows 7/10, you can try Git Bash in place of Cygwin which is lighter in size. For Windows 10 (only 64bits), see how to install Bash shell command-line tool.

Your host machine just needs a little cpu power (at least 4 cores), memory (at least 2 GB) and free disk space (at least 20 GB). For testing on local data center (e.g. with VMware vSphere), see how to proceed with the right machine driver and then consequently adapt the script and the procedure.

To learn more about Docker-machine, we suggest the Sreenivas Makam's blog and of course the official documentention and especially the "Get started" page.


The Oracle VM VirtualBox software along with the Oracle VM VirtualBox Extension Pack must be installed on your machine.

Install Docker Machine

Copy-paste the right command line for your OS at

Note: before executing, you must close the VirtualBox GUI if opened

$ curl -L > "/usr/bin/docker-machine.exe" && \
 chmod +x "/usr/bin/docker-machine.exe"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   623    0   623    0     0   1068      0 --:--:-- --:--:-- --:--:--  1070
100 27.2M  100 27.2M    0     0  3767k      0  0:00:07  0:00:07 --:--:-- 5466k

Create the shell script

This small shell script creates a VirtualBox VM with the NMRProcFlow installed. When finished, the IP address is given.



/usr/bin/docker-machine create --driver $DRIVER --engine-storage-driver overlay \
      --${DRIVER}-cpu-count "$VMCPU" --${DRIVER}-disk-size "$VMDISKSIZE" --${DRIVER}-memory "$VMMEMORY" $VMNAME

eval $(/usr/bin/docker-machine env $VMNAME)

/usr/bin/docker-machine ls

echo "---"
echo "Install NMRProcFlow on the VM"
echo "---"
/usr/bin/docker-machine ssh $VMNAME "cd /home/docker && wget && chmod +x ./ && sudo ./ && sudo ./npflow start && sudo ./npflow ps"

echo "---"
echo -n "IP of the VM: "
echo $(/usr/bin/docker-machine ip $VMNAME)
echo "---"

Execute the shell script

Note: before executing, you must close the VirtualBox GUI if opened

sh ./create_dockMach_npflow
Running pre-create checks...
(npflow) Default Boot2Docker ISO is out-of-date, downloading the latest release...
(npflow) Latest release for is v18.05.0-ce
(npflow) Downloading C:\Users\djaco\.docker\machine\cache\boot2docker.iso from
(npflow) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Creating machine...
(npflow) Copying C:\Users\djaco\.docker\machine\cache\boot2docker.iso to C:\Users\djaco\.docker\machine\machines\npflow\boot2docker.iso...
(npflow) Creating VirtualBox VM...
(npflow) Creating SSH key...
(npflow) Starting the VM...
(npflow) Check network to re-create if needed...
(npflow) Windows might ask for the permission to create a network adapter. Sometimes, such confirmation window is minimized in the taskbar.
(npflow) Found a new host-only adapter: "VirtualBox Host-Only Ethernet Adapter #3"
(npflow) Windows might ask for the permission to configure a network adapter. Sometimes, such confirmation window is minimized in the taskbar.
(npflow) Windows might ask for the permission to configure a dhcp server. Sometimes, such confirmation window is minimized in the taskbar.
(npflow) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: C:\cygwin64\bin\docker-machine.exe env npflow
NAME     ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER        ERRORS
npflow   *        virtualbox   Running   tcp://           v18.05.0-ce

Install NMRProcFlow on the VM
Connecting to (
Connecting to ( 100% |*******************************|  2210   0:00:00 ETA

latest: Pulling from nmrprocflow/nmrprocflow
Digest: sha256:2fc759c03bad09111a43646a728eb27aa00603c0ad828a3e75dc190fbb6f3eec
Status: Downloaded newer image for nmrprocflow/nmrprocflow:latest
CONTAINER ID        IMAGE                            COMMAND                  CREATED             STATUS                  PORTS                NAMES
0b31ba3eccf3        nmrprocflow/nmrprocflow:latest   "/usr/bin/launch-ser…"   1 second ago        Up Less than a second>80/tcp   npflow

IP of the VM:

Launch the application in your favorite web browser

Manage the machine

Note: before running any docker-machine command, you must close the VirtualBox GUI if opened

# Run this command to configure your shell (cygwin) before execute any docker-machine command
eval $("/usr/bin/docker-machine.exe" env npflow)

# List machines
$ /usr/bin/docker-machine ls
NAME     ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER        ERRORS
npflow   *        virtualbox   Running   tcp://           v18.05.0-ce

# show help about docker-machine
$ /usr/bin/docker-machine
Usage: docker-machine.exe [OPTIONS] COMMAND [arg...]

Create and manage machines running Docker.

Version: 0.15.0, build b48dc28d

  Docker Machine Contributors - <>

  --debug, -D                                           Enable debug mode
  --storage-path, -s "C:\Users\djaco\.docker\machine"   Configures storage path [$MACHINE_STORAGE_PATH]
  --tls-ca-cert                                         CA to verify remotes against [$MACHINE_TLS_CA_CERT]
  --tls-ca-key                                          Private key to generate certificates [$MACHINE_TLS_CA_KEY]
  --tls-client-cert                                     Client cert to use for TLS [$MACHINE_TLS_CLIENT_CERT]
  --tls-client-key                                      Private key used in client TLS auth [$MACHINE_TLS_CLIENT_KEY]
  --github-api-token                                    Token to use for requests to the Github API [$MACHINE_GITHUB_API_TOKEN]
  --native-ssh                                          Use the native (Go-based) SSH implementation. [$MACHINE_NATIVE_SSH]
  --bugsnag-api-token                                   BugSnag API token for crash reporting [$MACHINE_BUGSNAG_API_TOKEN]
  --help, -h                                            show help
  --version, -v                                         print the version

  active                Print which machine is active
  config                Print the connection config for machine
  create                Create a machine
  env                   Display the commands to set up the environment for the Docker client
  inspect               Inspect information about a machine
  ip                    Get the IP address of a machine
  kill                  Kill a machine
  ls                    List machines
  provision             Re-provision existing machines
  regenerate-certs      Regenerate TLS Certificates for a machine
  restart               Restart a machine
  rm                    Remove a machine
  ssh                   Log into or run a command on a machine with SSH.
  scp                   Copy files between machines
  mount                 Mount or unmount a directory from a machine with SSHFS.
  start                 Start a machine
  status                Get the status of a machine
  stop                  Stop a machine
  upgrade               Upgrade a machine to the latest version of Docker
  url                   Get the URL of a machine
  version               Show the Docker Machine version or a machine docker version
  help                  Shows a list of commands or help for one command

Remove the machine

Note: before remove, you must close the VirtualBox GUI if opened

$ docker-machine.exe rm npflow
About to remove npflow
WARNING: This action will delete both local reference and remote instance.
Are you sure? (y/n): y
Successfully removed npflow