Skip to content

Instantly share code, notes, and snippets.

@alexeiz
Last active March 25, 2016 03:50
Show Gist options
  • Save alexeiz/28941769923e3da6b906 to your computer and use it in GitHub Desktop.
Save alexeiz/28941769923e3da6b906 to your computer and use it in GitHub Desktop.
Add an arbitrary mount point to Docker Toolbox containers
  • Add a "Shared Folder" to the default docker VirtualBox virtual machine. There is already a shared folder C:\Users. Add, for example, share host C:\Temp directory as c/Temp.
  • Add the following code to C:\Program Files\Docker Toolbox\start.sh:
init_mounts() {
    ${DOCKER_MACHINE} ssh ${VM} sudo 'mkdir /c/Temp'
    ${DOCKER_MACHINE} ssh ${VM} sudo 'chown docker:staff /c/Temp'
    ${DOCKER_MACHINE} ssh ${VM} sudo 'mount -t vboxsf c/Temp /c/Temp'
}
export -f init_mounts

if [ "${VM_STATUS}" != "Running" ]; then
    init_mounts
fi
  • To verify that the mount point is created successfully, run this in the Docker Terminal:
$ docker-machine ssh default 'tail -1 /etc/mtab'
c/Temp /c/Temp vboxsf rw,nodev,relatime 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment