docker-db-1 startup error #8084

Closed
opened 2026-02-21 18:23:49 -05:00 by yindo · 4 comments
Owner

Originally created by @MatchlessAllen on GitHub (Feb 8, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

unknown

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

Image

Image

I executed the docker compose up -d command in the dify/docker directory, which initially appeared to complete successfully. However, upon checking Docker Desktop, I noticed that the 'docker-db-1' container failed to start properly. The error log indicates: 'FATAL: data directory "/var/lib/postgresql/data/pgdata" has invalid permissions'.

✔️ Expected Behavior

Install page is work

Actual Behavior

Install page isn't work

Originally created by @MatchlessAllen on GitHub (Feb 8, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version unknown ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ![Image](https://github.com/user-attachments/assets/65f22428-24b1-4d65-adee-9a00f277ea7b) ![Image](https://github.com/user-attachments/assets/e19f193b-fe55-43de-a1d7-7935c60980bb) ![Image](https://github.com/user-attachments/assets/cc4069db-63a2-4255-9638-09ea17f7cfcd) I executed the docker compose up -d command in the dify/docker directory, which initially appeared to complete successfully. However, upon checking Docker Desktop, I noticed that the 'docker-db-1' container failed to start properly. The error log indicates: 'FATAL: data directory "/var/lib/postgresql/data/pgdata" has invalid permissions'. ### ✔️ Expected Behavior Install page is work ### ❌ Actual Behavior Install page isn't work
yindo added the 🐞 bug label 2026-02-21 18:23:49 -05:00
yindo closed this issue 2026-02-21 18:23:50 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 8, 2025):

Hey @MatchlessAllen! 👋 I'm here to help you with any bugs, questions, or contributions you have for Dify. I'm here to assist you while waiting for a human maintainer. Let's squash those bugs together!

To resolve the startup error for the 'docker-db-1' container due to invalid permissions on the data directory "/var/lib/postgresql/data/pgdata", you should ensure that the host directory ./volumes/db/data has the correct permissions. The PostgreSQL container requires that the data directory be writable by the PostgreSQL user inside the container.

You can fix this by running the following command on your host machine to set the correct permissions:

sudo chown -R 999:999 ./volumes/db/data

This command changes the ownership of the ./volumes/db/data directory to the user ID and group ID that the PostgreSQL container uses (commonly 999 for the postgres user in the official PostgreSQL Docker image). This should resolve the permission issue and allow the container to start successfully [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Feb 8, 2025): <!-- Greeting --> Hey @MatchlessAllen! 👋 I'm here to help you with any bugs, questions, or contributions you have for Dify. I'm here to assist you while waiting for a human maintainer. Let's squash those bugs together! <!-- Answer --> To resolve the startup error for the 'docker-db-1' container due to invalid permissions on the data directory "/var/lib/postgresql/data/pgdata", you should ensure that the host directory `./volumes/db/data` has the correct permissions. The PostgreSQL container requires that the data directory be writable by the PostgreSQL user inside the container. You can fix this by running the following command on your host machine to set the correct permissions: ```bash sudo chown -R 999:999 ./volumes/db/data ``` This command changes the ownership of the `./volumes/db/data` directory to the user ID and group ID that the PostgreSQL container uses (commonly 999 for the `postgres` user in the official PostgreSQL Docker image). This should resolve the permission issue and allow the container to start successfully <sup>[[1]](https://github.com/langgenius/dify/blob/main/docker/docker-compose-template.yaml)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/d4e91a5e-ade6-47d1-a4ac-0e2b5d496f3b?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/d4e91a5e-ade6-47d1-a4ac-0e2b5d496f3b?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/d4e91a5e-ade6-47d1-a4ac-0e2b5d496f3b?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/d4e91a5e-ade6-47d1-a4ac-0e2b5d496f3b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d4e91a5e-ade6-47d1-a4ac-0e2b5d496f3b?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/d4e91a5e-ade6-47d1-a4ac-0e2b5d496f3b?feedback_type=other)</sup>
Author
Owner

@jingyuzhaobj commented on GitHub (Feb 18, 2025):

I login in WSL from powershell in windows 10,if you input sudo chown -R 999:999 ./volumes/db/data command,it show :chown: cannot access './volumes/db/data': No such file or directory?please help me.

@jingyuzhaobj commented on GitHub (Feb 18, 2025): I login in WSL from powershell in windows 10,if you input sudo chown -R 999:999 ./volumes/db/data command,it show :chown: cannot access './volumes/db/data': No such file or directory?please help me.
Author
Owner

@MatchlessAllen commented on GitHub (Feb 19, 2025):

I solved this issue by upgrading my Windows system and using WSL instead of Hyper-V to run Docker Desktop. It seems that Hyper-V was the cause of the database container failing to start properly.

@MatchlessAllen commented on GitHub (Feb 19, 2025): I solved this issue by upgrading my Windows system and using WSL instead of Hyper-V to run Docker Desktop. It seems that Hyper-V was the cause of the database container failing to start properly.
Author
Owner

@bluehat999 commented on GitHub (May 9, 2025):

shared a solusion for macos, using Rancher Desktop:

  1. change Virtual Machine Type to VZ(Apple Virtualization framework)
  2. change Volumns Mount Type to virtios
  3. restart Rancher Desktop
    Image
@bluehat999 commented on GitHub (May 9, 2025): shared a solusion for macos, using Rancher Desktop: 1. change Virtual Machine Type to VZ(Apple Virtualization framework) 2. change Volumns Mount Type to virtios 3. restart Rancher Desktop ![Image](https://github.com/user-attachments/assets/1bb7e590-d229-4b19-bae8-2b127e1052a1)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8084