GMOD / docker-apollo

:whale: Apollo 2.X Docker Image
GNU General Public License v3.0
10 stars 12 forks source link

docker-compose down removes Organism #8

Closed mictadlo closed 5 years ago

mictadlo commented 8 years ago

Hi @erasche and @nathandunn, How is it possible to avoid that docker-compose down deletes Organism?

Thank you in advance,

Mic

hexylena commented 8 years ago

Hi @mictadlo it does not, in my experience (but I only run GNU/linux)

If you are using an explicit volume for the postgres database, then the data will be persisted in that directory.

If you are not using an explicit volume, then the volume should be persisted in the docker directory and used automatically.

I would guess that this is another OSX oddity.

mictadlo commented 8 years ago

I am running OS X as host and Linux Mint is installed in VirtualBox. How would I need to change the docker-compose.yml to explicitly be able to use volume for postgres database in order persist the data?

hexylena commented 8 years ago

https://github.com/GMOD/docker-apollo/blob/master/docker-compose.yml#L35 should be sufficient.

Are you running docker inside the Linux Mint guest VM?

mictadlo commented 8 years ago

Yes, I am running docker inside Linux Mint 18 VM.

  1. What kind of difference would this make /srv/docker/postgresql:/var/lib/postgresql as describe here?
  2. What happens if e.g postgres image get security updates. How can I update the image without losing data stored in the database?
mictadlo commented 8 years ago

... I watched this video and the solution was docker run --rm --volumes-from john1 -v $(pwd):/backup busybox tar cvf /backup/john2.tar /john. Probably to backup the database it would be necessary to dump it somehow.

hexylena commented 8 years ago
  1. No difference, that is the same. Just mounts a different directory.
  2. The postgres database is stored as files on disk. If the image gets (security, or other) updates that required changes to the on-disk format, postgres would handle that.

As for backing up the database, it is much simpler to do something like:

$ docker exec -it my-postgres-image-id pg_dump -U postgres | gzip > my-backup.sql.gz

to dump the database. If you are even braver, you could just backup your mounted volume directory, which should work in theory, but I would only do that with the image turned off (just like backing up a regular postgres instance, wouldn't want to copy possibly mid-write, and corrupted files)