How to persist changes to boot2docker in docker-machine?
I am using docker-machine which I use to manage VM running boot2docker with virtualbox as driver. I need to mount directory to this VM. I was able to do that by adding the folder to shared folders list in settings of VM in Virtualbox Manager. Then using
sudo mount -t vboxsf -o uid=1000,gid=50 <name of folder in VM settings> <folder name>. It worked & I added the command to create directory & mount without using relative address to
etc/rc.local . The changes I made to VM don’t persist when I restart the VM. What do I do?
I am working on Ubuntu 14.04.
2 Solutions collect form web for “How to persist changes to boot2docker in docker-machine?”
Create a folder. Inside, create a
Dockerfile. The first line should be
FROM plus the name of the image which you currently use.
Then you can add the commands to modify the base image. In your case, put a copy of
rc.local in the same folder as the
Now you can copy it into your new image with:
ADD rc.local /etc
You can then build your new image with
docker build -t user1932582/myapp .
That creates a new image which you can run with
docker run user1932582/myapp
The persistent directories are documented here: https://github.com/boot2docker/boot2docker/blob/master/doc/FAQ.md#local-customisation-with-persistent-partition
So you can add your
mount command to