6

I have an OSX host with a postgreSQL database (actually experimenting with it for Redmine). All I want is to be able to keep data after I destroy a container so I'll be safe and I can re-deploy my repository fast.

If I try to add a local Volume in Kitematic, the container fails to start with error:

initdb: could not create directory "/var/lib/postgresql/data/pg_xlog/archive_status":  Permission denied
initdb: removing contents of data directory "/var/lib/postgresql/data"
creating subdirectories ... 

I've tried to chmod 777 -R the local folder but same result. Does anyone have any solution for this or anything else to suggest on saving/keeping data from postgreSQL and docker ?

1 Answer 1

1

OSX means boot2docker, and that Linux VM will:

  • only mount /Users (from your host)
  • only persists data from /var/lib/docker and /var/lib/boot2docker

So, /var/lib/postgresql is either:

  • not visible from the VM (not mounted)
  • not writable or persisted from within the VM

The command docker volume create should enable you to create a volume in the right path.
See:

Sign up to request clarification or add additional context in comments.

3 Comments

Indeed but do you have any solution to suggest for keeping data ? Except building another vm (e.g. Vagrant) and install docker inside ?
I actually added a volume but postgres fails to start with the message above. Does it make sense ? The issue happens If I enter the Volumes tab in Kitematic and try to map with a local drive.
@ChrisV. forget Kitematic for now. Try it with a docker-compose.yml file.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.