I am trying to figure out why I am getting an error about postgresql not running in my project.
It is not connecting through Flask, nor when I try to access it through bash using the command
docker-compose run postgres bash
then psql
returns the error:
bash-5.0# psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I tried running --force-recreate
and to drop all abandoned orphan containers but this has not seemed to work. Similarly, I made sure it does not interfere with my local postgresql installation by uninstalling the local one and removing all files. I am pretty stumped on this.
Here is my docker-compose file:
version: "3"
services:
webapp:
build: .
container_name: webapp
ports:
- "5000:5000"
postgres:
image: postgres:11-alpine
container_name: postgres
ports:
- "5432:5432"
environment:
- POSTGRES_DB=tmp
- POSTGRES_USER=tmp
- POSTGRES_PASSWORD=tmp_password
volumes: # Persist the db data
- database-data:/var/lib/postgresql/data
volumes:
database-data:
Any help is appreciated.