I'm experiencing issues using the official Postgres docker image, something that never happened on this machine.
I'm using that through docker-compose but when running docker-compose up, the db container does not start, here's the error:
db_1 | 2019-04-19 22:20:27.180 UTC [1] FATAL: lock file "postmaster.pid" is empty
db_1 | 2019-04-19 22:20:27.180 UTC [1] HINT: Either another server is starting, or the lock file is the remnant of a previous server startup crash.
I tried several times to remove the image so it then will be re-pulled, but hasn't solved the problem.
I'm using Docker for Mac 2.0.0.3 (31259)
here's the docker-compose.yml:
version: '2'
services:
web:
build: .
entrypoint: sh -c "python3 /var/www/my_project/manage.py migrate --noinput &&
python3 /var/www/my_project/manage.py runserver 0.0.0.0:8000"
restart: on-failure
ports:
- "9001:8000"
volumes:
- .:/var/www/my_project
depends_on:
- db
env_file:
- ./.env
environment:
- DB_SERVER=db
- DB_NAME=postgres
- DB_USER=postgres
db:
ports:
- "9432:5432"
image: postgres
volumes:
- database:/var/lib/postgresql
volumes:
database:
Any help on this?
You can try to remove the pid file manually from the volume mounted by the container. Something like this:
Search the volume:
docker inspect container-name
Search for the directory where the volume is stored:
...
"Mounts": [
{
"Type": "volume",
"Name": "9009b4e54686dc36f797a15fd8fc09213f3e8949583b823525881c010f2fe347",
"Source": "/var/lib/docker/volumes/9009b4e54686dc36f797a15fd8fc09213f3e8949583b823525881c010f2fe347/_data",
Now delete the pid file:
rm /var/lib/docker/volumes/9009b4e54686dc36f797a15fd8fc09213f3e8949583b823525881c010f2fe347/_data/
After this you might get this error message:
lock file "/var/run/postgresql/.s.PGSQL.5432.lock" is empty
This can be fixed by overwriting that file with a file containing a number:
echo 12345 > bla
docker cp bla container-name:/var/run/postgresql/.s.PGSQL.5432.lock
docker restart container-name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With