Lost database connection using Docker desktop

Hello,

I am running docker desktop under windows 10 to host wikijs as a local service on my desktop computer.

All has been fine for a couple of years, but yesterday I upgraded to the latest versions of docker and wikijs and now my database connection seems to have been lost

In a windows 10 cmd line as administrator I ran the following commands:
docker stop wiki
docker rm wiki

docker run -d -p 8080:3000 --name wiki --restart unless-stopped -e “DB_TYPE=postgres” -e “DB_HOST=db” -e “DB_PORT=5432” -e “DB_USER=wikijs” -e “DB_PASS=wikijsrocks” -e “DB_NAME=wiki_db-data” Package wiki · GitHub

and it produces this output:
5cfc2cb10b2a1645a31d25c75273a0a149ee612b22964a6c41398a7cbc412e39

The wiki container starts when I’m using the docker desktop gui, but if I look at the wiki container log, I see this

03-08T14:46:33.894Z [MASTER] warn: Will retry in 3 seconds… [Attempt 10 of 10]
2025-03-08 14:46:38 Loading configuration from /wiki/config.yml… OK
2025-03-08 14:46:39 2025-03-08T14:46:39.066Z [MASTER] info: =======================================
2025-03-08 14:46:39 2025-03-08T14:46:39.068Z [MASTER] info: = Wiki.js 2.5.306 =====================
2025-03-08 14:46:39 2025-03-08T14:46:39.069Z [MASTER] info: =======================================
2025-03-08 14:46:39 2025-03-08T14:46:39.069Z [MASTER] info: Initializing…
2025-03-08 14:46:39 2025-03-08T14:46:39.523Z [MASTER] info: Using database driver pg for postgres [ OK ]
2025-03-08 14:46:39 2025-03-08T14:46:39.526Z [MASTER] info: Connecting to database…
2025-03-08 14:46:42 2025-03-08T14:46:42.849Z [MASTER] error: Database Connection Error: ENOTFOUND undefined:undefined
2025-03-08 14:46:42 2025-03-08T14:46:42.849Z [MASTER] warn: Will retry in 3 seconds… [Attempt 1 of 10]
2025-03-08 14:46:45 2025-03-08T14:46:45.854Z [MASTER] info: Connecting to database…
2025-03-08 14:46:49 2025-03-08T14:46:49.159Z [MASTER] error: Database Connection Error: ENOTFOUND undefined:undefined
2025-03-08 14:46:49 2025-03-08T14:46:49.159Z [MASTER] warn: Will retry in 3 seconds… [Attempt 2 of 10]
2025-03-08 14:46:52 2025-03-08T14:46:52.165Z [MASTER] info: Connecting to database…
2025-03-08 14:46:55 2025-03-08T14:46:55.477Z [MASTER] error: Databas

I am new to Docker desktop and have found it works really well for my wiki application, this is the first problem I’ve had, any help for things to try much appreciated.

Paul

1 Like

Can you use this below step to troubleshoot the issues
Check if PostgreSQL is Running

Run docker ps to see if the database container is active.
If not, start it using:

docker run -d --name db -e POSTGRES_USER=wikijs -e POSTGRES_PASSWORD=wikijsrocks -e POSTGRES_DB=wiki_db -p 5432:5432 postgres:13
Verify Database Name

Ensure DB_NAME=wiki_db instead of wiki_db-data.
Use a Docker Network

Create a network and run both containers inside it:

docker network create wikinet

docker run -d --name db --network=wikinet -e POSTGRES_USER=wikijs -e POSTGRES_PASSWORD=wikijsrocks -e POSTGRES_DB=wiki_db -p 5432:5432 postgres:13

docker run -d --name wiki --network=wikinet -p 8080:3000 --restart unless-stopped
-e “DB_TYPE=postgres” -e “DB_HOST=db” -e “DB_PORT=5432”
-e “DB_USER=wikijs” -e “DB_PASS=wikijsrocks” -e “DB_NAME=wiki_db”
requarks/wiki:latest
Check Database Logs for Errors

Run docker logs db to identify issues.
Restart Docker

Restart Docker Desktop or use:

docker-compose down && docker-compose up -d

Thanks very much for your help with this. I used the commands you suggested and a wiki container and db container were created in docker desktop. When I enter the localhost url into my browser I get to a brand new wikijs page which offers to install wikijs 2.5.306, which is useful, should I go ahead and install?

I now need to configure things so that the database used is the one for the wiki I have developed over the last year or so.
I think I can use the commands you have provided to set up my own database container, but how do I find my database?

te other persistent problem I have is that when I close docker desktop, I can’t tun it again - the GUI does not appear. I have to terminate tasks in windows task manager.

many thanks,
Paul

Since you’ve been using Wiki.js for a year, your old database might be: Stored in a Docker Volume
Run the following command to check existing volumes: docker volume ls

Look for a volume related to your old database, possibly named something like:

local_pgdata
wikijs_db_volume
postgres_data

If you find it, create a new database container using this volume:
docker run -d --name db --network=wikinet -v local_pgdata:/var/lib/postgresql/data
-e POSTGRES_USER=wikijs -e POSTGRES_PASSWORD=wikijsrocks -e POSTGRES_DB=wiki_db
-p 5432:5432 postgres:13

thanks again, I think I found the database, it’s called wiki_db-data

so this is what I did:

docker run -d --name db01 --network=wikinet -v local_pgdata:/var/lib/postgresql/data -e POSTGRES_USER=wikijs -e POSTGRES_PASSWORD=wikijsrocks -e POSTGRES_DB=wiki_db-data -p 5432:5432 postgres:13

and
docker run -d --name wiki --network=wikinet -p 8080:3000 --restart unless-stopped -e “DB_TYPE=postgres” -e “DB_HOST=db” -e “DB_PORT=5432” -e “DB_USER=wikijs” -e “DB_PASS=wikijsrocks” -e “DB_NAME=db01” requarks/wiki:latest

both containers are running in docker desktop, but when I try to access localhost, I get the message:

the connection was reset

also inspecting the wiki container logs:

ASTER] info: = Wiki.js 2.5.306 =====================
2025-03-09 13:00:01 2025-03-09T13:00:01.580Z [MASTER] info: =======================================
2025-03-09 13:00:01 2025-03-09T13:00:01.580Z [MASTER] info: Initializing…
2025-03-09 13:00:01 2025-03-09T13:00:01.967Z [MASTER] info: Using database driver pg for postgres [ OK ]
2025-03-09 13:00:01 2025-03-09T13:00:01.970Z [MASTER] info: Connecting to database…
2025-03-09 13:00:05 2025-03-09T13:00:05.313Z [MASTER] error: Database Connection Error: ENOTFOUND undefined:undefined
2025-03-09 13:00:05 2025-03-09T13:00:05.314Z [MASTER] warn: Will retry in 3 seconds… [Attempt 1 of 10]
2025-03-09 13:00:08 2025-03-09T13:00:08.317Z [MASTER] info: Connecting to database…
2025-03-09 13:00:11 2025-03-09T13:00:11.602Z [MASTER] error: Database Connection Error: ENOTFOUND undefined:undefined
2025-03-09 13:00:11 2025-03-09T13:00:11.603Z [MASTER] warn: Will retry in 3 seconds… [Attempt 2 of 10]

In windows file manager I manged to list all docker volumes. Some are named, the most likely named one was wiki_db-data, but I cannot get this to connect.

So i’m now thinking that somehow my database has been lost / deleted.

However, in the volume list, there are some volumes which are ids e.g.
02dea3ba9f6306826b3e6dca07b5d4384d53e8892f402a028d20ae5e7de7da90

Is there any way I can create a db from the volume id?

Many thanks for your help,
Paul

thanks for help, I used copilot extensively to check out database conatiners and wiki container, but all my data is gone.
My own fault for not creating a backup.
Happy days :slight_smile:

I haven’t had time to read the whole topic, but that is an anonymous volume and you can mount anonymous volumes as any other by referring to its name