Docker – boot2docker -Share folder

To share another folder than the default one (C:\Users)

First, add the folder to share in VirtualBox


Than, connect to the docker VM by running

docker-machine ssh

There you need to run

sudo mkdir --parents //d/tangu
sudo mount -t vboxsf tangu //d/tangu

The first command create the folder where the shared drive will be mounted and the second command actually mount the shared drive.

Of course you’ll need to adapt the paths I used here to match yours.
Note that the mount command takes as arguments

  • -t specifies the filesystem. Here its the one from virtualbox
  • tangu is the named of the shared folder defined in virtual box
  • //d/tangu is the destination of the mount shared drive that was created by the first command

You don’t want to type those commands everytime

Add those lines between the step STEP=”Checking status on $VM” and the step STEP=”Setting env” :

STEP="Mounting web directory"
"${DOCKER_MACHINE}" ssh default 'sudo mkdir --parents //d/tangu'
"${DOCKER_MACHINE}" ssh default 'sudo mount -t vboxsf tangu //d/tangu'

To the file located where you installed Docker Toolbox

Now everytime you will start boot2docker, it will auto mount this shared folder.

Credits :


Docker – boot2docker – Create a new docker virtual machine to a specific location

Yesterday I told about moving the exisitng default boot2docker machine to my secondary hard drive.

Today, I wanted to create a new docker virtual machine directly to a specific location.

docker-machine -s "D:\softwares\Docker Toolbox\docker-vm" create --driver virtualbox machineName

Set as default location

Finally, I want to always use this new location so as mentionned here I created the variable environnement MACHINE_STORAGE_PATH with the path = D:\softwares\Docker Toolbox\docker-vm

Docker – Move boot2docker machine to secondary hard drive – Windows 10 Home edition

Docker images can take a lot of spaces over time.
My primary hard drive is a 128GO SSD so I wanted to move my boot2docker virtual machine to my secondary hard drive (D:/).

I followed those instruction.

Here is the summary:

  1. Open virtualbox
  2. Stop the virtual machine default if it’s in function
  3. File > Virtual Media Manager
  4. Make a copy of disk.vmdk to the desired location on your secondary hard drive
    1. Type is VMDK
    2. Choose Dynamically allocated
    3. Choose the new location
  5. Go the Settings of the machine default
  6. Go to Storage tab
  7. Select disk.vmdk and remove it
    1. Note: take note of the SATA port
  8. Add a new existing hard drive and select the copied one
  9. Make sure the SATA port is the same as previously
  10. Launch docker again

Make sure your images are still there by running

docker images

You can safely delete the old hard drive

Note: It is located under C:\Users\%Username%\.docker\machine\machines\disk.vmdk