I want to run the Docker image postgres:9
, stop Postgres, move it to /dev/shm
, and restart it, so I can run my application tests really fast.
But when I try to stop Postgres in the container using postgres
or pg_ctl
I get told cannot be run as root
.
Since all Docker containers log you in as the root user what can I do to run the Postgres commands I need?
And which folders do I need to move to /dev/shm
before restarting it?
Command to start the container if you want to try this:
docker run -it postgres:9 bash
cd /usr/lib/postgresql/9.6/bin
./pg_ctl stop