Docker Community Forums

Share and learn in the Docker community.

Cant we create folders and store data in the VM created using Docker-machine?

(Sharath Kumar) #1

In the virtual machine which i created using docker-machine create command i am not able to store any data. Its like when i stop a virtual machine using docker-machine stop command all my data gets destroyed. Does anyone have solution for this ? How can i save any data on the VM ?

(Jeff Anderson) #2

This is a feature of the iso that the VM boots with. There are two places that will persist.

There is a hard drive that is created and attached, and that gets mounted at /mnt/sda1. The /var/lib/docker location is a symlink into that hard drive so containers will persist across reboots.

The other location that persists is the /Users mount. It is a virtualbox shared folders mount of your VM host’s /Users folder. from the point of view of the VM, everything in /Users will be owned by uid:gid 1000:50.

If you would like system-level changes to persist across reboots, you can create a script called /var/lib/boot2docker/ and put commands in there that you want to run at the next boot. This is handy for things like custom certificate authority certificates or installing packages.

Hopefully this helps.