Added advice on how to persist changes with boot2docker

This commit is contained in:
Jannis Gebauer 2015-09-28 09:42:13 +02:00
parent 86d9c848ca
commit d8a7081d4c

View File

@ -57,6 +57,28 @@ Acquiring the IP Address is good for two reasons:
$ docker-machine ip dev1 $ docker-machine ip dev1
123.456.789.012 123.456.789.012
Saving changes
--------------
If you are using OS X or Windows, you need to create a /data partition inside the
virtual machine that runs the docker deamon in order make all changes persistent.
If you don't do that your /data directory will get wiped out on every reboot.
To create a persistent folder, log into the virtual machine by running:
::
$ docker-machine ssh dev1
$ sudo su
$ echo 'ln -sfn /mnt/sda1/data /data' >> /var/lib/boot2docker/bootlocal.sh
In case you are wondering why you can't use a host volume to keep the files on
your mac: As of `boot2docker` 1.7 you'll run into permission problems with mounted
host volumes if the container creates his own user and chown's the directories
on the volume. Postgres is doing that, so we need this quick fix to ensure that
all development data persists.
Build the Stack Build the Stack
--------------- ---------------
@ -130,20 +152,3 @@ To migrate your app and to create a superuser, run::
$ docker-compose run django python manage.py migrate $ docker-compose run django python manage.py migrate
$ docker-compose run django python manage.py createsuperuser $ docker-compose run django python manage.py createsuperuser
If you are using `boot2docker` to develop on OS X or Windows, you need to create a `/data` partition inside your boot2docker
vm to make all changes persistent. If you don't do that your `/data` directory will get wiped out on every reboot.
To create a persistent folder, log into the `boot2docker` vm by running::
$ bootdocker ssh
And then::
$ sudo su
$ echo 'ln -sfn /mnt/sda1/data /data' >> /var/lib/boot2docker/bootlocal.sh
In case you are wondering why you can't use a host volume to keep the files on your mac: As of `boot2docker` 1.7 you'll
run into permission problems with mounted host volumes if the container creates his own user and chown's the directories
on the volume. Postgres is doing that, so we need this quick fix to ensure that all development data persists.