I'm having trouble with my Docker containers lately. Normally, I just run `docker compose up --build -d` in the directory with my compose file to redeploy everything, but now it fails with an error. The error message states that Docker can't create a task for a container due to a mounting issue with a specific directory that's supposed to lead to a PostgreSQL data path. The directory `/datapool/Docker/data/overlay2//merged` doesn't exist. I've checked the file structure and my overlay2 directory only contains 'diff', 'link', 'lower', and 'work'. I haven't tampered with any of this or run out of disk space. I've also tried various pruning commands and even stopped Docker to rename the overlay2 directory, but nothing seems to work. Can anyone suggest what I might try to resolve this?
3 Answers
First off, you should check if the directory `/datapool/Docker/data/volumes/pollygraph_db` exists because it seems Docker can't find it to mount the volume. How are you defining your volumes in the compose file?
I can’t explain exactly what went wrong, but I’d suggest backing up the data volume just to be safe. You might need to stop Docker, remove the entire `/var/lib/docker` directory, and recreate your containers from scratch.
It sounds like you might have pulled the latest version of the PostgreSQL container, which changed the mount point to `/var/lib/postgresql` instead of `/var/lib/postgresql/data`. You could either pin your container to an older version or check out their instructions on Docker Hub.
That was it! I had used `postgres:alpine` which pulled the latest version by default. After pinning it to version 17, everything worked again. It’s surprising how a small change would cause such issues.
Yes, it exists, thankfully! That's where all my data is stored, but the path it was trying to mount in overlay2 doesn't.