Docker Compose - Error while starting DB container
I have currently the same issue described here https://github.com/ckan/ckan/issues/6027 during starting db with docker compose -f docker-compose.yml up by getting the error initdb: directory "/var/lib/postgresql/data" exists but is not empty. A change of pg_data=/var/lib/postgresql/data/db or running docker system prune before don't work. I had no problems with the last week installed ckan-docker.
Does anybody have the same issue now!?
I'd make sure all db containers, images and volumes are completely removed before building the local images / running the containers again. Here is a reference in a recent PR that mentions the pg_data=/var/lib/postgresql/data/db config change
Thanks for your help. It worked for me by deleting files in the directory /var/lib/docker/volumes/ckan-docker_pg_data/_data. This is the directory which is mounted to /var/lib/postgresql/data in the ckan docker. So I don't have to change pg_data variable.
any feedback on this? still having the same issues
It all works (eventually) @ken-muturi - I suggest you remove all containers, images, networks, volumes plus run a docker system prune and then download, install etc
i get above even after running
docker stop $(docker ps -q); docker rm $(docker ps -aq); docker image rm $(docker image ls -q); docker network rm $(docker network ls -q); docker volume rm $(docker volume ls -q) followed by docker system prune
then
docker compose build
docker compose up
What do the db container logs say when it starts until it's reported to be unhealthy?
here is the log https://gist.github.com/ken-muturi/85e592107769f826b1db5845759e2b10
rename the 30_setup_test_databases.sql file to 30_setup_test_databases.sh and try again. Log looks fine to me. The errors are normal. I don't think sql file problem would cause the whole container to be unstable but you never know.
thanks for this; i got it pass but it seems my installation has lost of issues; i even cloned the repo again;
https://gist.github.com/ken-muturi/aec8834adcccdf46a602ac05a427f6c4
I got the same error today,
The 3 files have CRLF ending, changing them to LF will solve the issue from @kowh-ai 's last comment. If these file don's run on DB init, then tables, roles, and users don't get created, therefore all the rest fails.
docker volume prune was not enough, I had to docker volume rm ckan-docker_pg_data and make sure that the files were really gone from my FS before the database would boot.