Why Can’t I Run My PostgreSQL Container?

0
7
Asked By TechyNerd101 On

I'm having a tough time getting my PostgreSQL container to run. I'm encountering this error: "Error response from daemon: failed to create task for container... no such file or directory: unknown." I've set up my Docker configuration like this:

```
db:
image: postgres:latest
container_name: flatmate.db
environment:
POSTGRES_DB: flatmate
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- ./.containers/flatmate-db:/var/lib/postgresql/data
ports:
- "5432:5432"
```

Can someone help me understand what's going wrong?

1 Answer

Answered By DockerDiva42 On

It looks like you're using the `latest` tag for PostgreSQL, which can be risky! You might have accidentally updated to PostgreSQL 18, which changed the default data volume directory. Try switching your image to a specific version instead, like PostgreSQL 15, and it should solve your issue. Many people run into complications with the `latest` tag, so it's a good practice to avoid it. Let me know if you need more help!

TechyNerd101 -

Just changed the version to 15 and it’s fixed. Really appreciate it!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.