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.

  • Why doesn't the docker volume in Windows Server show up when I run this command?
  • Android / busybox / termux test envionment
  • centralize python imports for docker builds efficency?
  • Exposed Service unreachable
  • Docker client not working under ubuntu 12.04.4
  • Let's encrypt 502 bad gateway docker
  • Is it possible to assign a static public ip to a Docker Container?
  • crontab not running in docker container shell
  • How to communicate with docker container in weave?
  • Docker daemon fails
  • Remote debugging NodeJS in Docker with Visual Studio Code
  • PHPUnit testing FAILS ONLY when visiting the root page( visit('/') ) in Laravel 5
  • 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 Dockerfile

    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:

    So you can add your mount command to under /var/lib/boot2docker/ directory.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.