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.

  • How to get the service IP in Kubernetes?
  • Dependent Containers and Links with IBM DevOps Services Build Pipeline
  • Deploying docker swarm without using docker machine
  • Managing multiple GPUs with multiple users
  • how to mount volume in ElasticBeanstalk Docker container using only Dockerrun.aws.json
  • docker-compose scale does not work with haproxy
  • strace to monitor Dockerized application activity
  • Can Docker 1.12 in “swarm mode” provide “a single, virtual Docker host”?
  • A Neo4j container (docker) with initial data in it
  • Any API or Web UI project to manage a Docker private registry?
  • Self-hosted alternative to hub.docker.com?
  • How to maintain sticky session(session persistence) with docker swarm?
  • 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

    Related:

    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 bootlocal.sh under /var/lib/boot2docker/ directory.

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