I have a problem running the postgres container with setting volumes for the data folder on my Mac OS machine. I tried to run it like this:
docker run \ --name my-postgres \ -e POSTGRES_USER=admin \ -e POSTGRES_PASSWORD=password \ -e POSTGRES_DB=some_db_dev \ -v $PG_LOCAL_DATA:/var/lib/postgresql/data \ -d postgres:9.5.1
Every time I got the following output in the logs:
* Starting PostgreSQL The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.utf8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are enabled. fixing permissions on existing directory /var/lib/postgresql/data ... ok initdb: could not create directory "/var/lib/postgresql/data/pg_xlog": Permission denied initdb: removing contents of data directory "/var/lib/postgresql/data"
Versions of dockers, docker machines, virtual boxes and boot2docker:
docker-machine version 0.6.0, build e27fb87 Docker version 1.10.2, build c3959b1 VirtualBox Version 5.0.16 r105871 boot2docker 1.10.3
I have seen many publications on this topic, but most of them are out of date. I tried to make a similar solution, as for mysql , but that did not help.
Can someone please update me: is there any solution for running a postgres container with data volumes through a docker machine?
Thanks!
source share