postgres on docker fails with `chown: cannot dereference ... : No such file or directory`

Viewed 1704

I am trying to deploy postgres on docker and it exits immediately after I run it. On checking the logs I get the following error:

chown: cannot dereference '/var/lib/postgresql/data/venv/bin/python3': No such file or directory

The command am running is here below:

sudo docker run -p 5432:5432 -e POSTGRES_USER=superset -e POSTGRES_PASSWORD=mypostgrespassword -e POSTGRES_DB=superset --volume $PWD:/var/lib/postgresql/data -d postgres

How can I fix that?

1 Answers

The problem here is, that the directory you are mounting, is not empty.
Create a empty directory, for example /opt/pgdata and then mount that one:

docker run -p 5432:5432 -e POSTGRES_USER=superset -e POSTGRES_PASSWORD=mypostgrespassword -e POSTGRES_DB=superset -v /opt/pgdata:/var/lib/postgresql/data -d postgres
Related