> 技术文档 > docker compose up -d后,docker-db-1 无法正常 Running,总是重启 Restarting

docker compose up -d后,docker-db-1 无法正常 Running,总是重启 Restarting

启动后localhost/install 页面不停的转圈,无法输入admin管理员密码。

日志报错如下:

2024-12-25 10:11:46 db-1 | The files belonging to this database system will be owned by user \"postgres\".2024-12-25 10:11:46 db-1 | This user must also own the server process.2024-12-25 10:11:46 db-1 | 2024-12-25 10:11:46 db-1 | The database cluster will be initialized with locale \"en_US.utf8\".2024-12-25 10:11:46 db-1 | The default database encoding has accordingly been set to \"UTF8\".2024-12-25 10:11:46 db-1 | The default text search configuration will be set to \"english\".2024-12-25 10:11:46 db-1 | 2024-12-25 10:11:46 db-1 | Data page checksums are disabled.2024-12-25 10:11:46 db-1 | 2024-12-25 10:11:46 db-1 | initdb: error: could not change permissions of directory \"/var/lib/postgresql/data/pgdata\": Operation not permitted2024-12-25 10:11:46 db-1 | fixing permissions on existing directory /var/lib/postgresql/data/pgdata ... 2024-12-25T02:12:46.866162406Z chmod: /var/lib/postgresql/data/pgdata: Operation not permitted2024-12-25 10:12:46 db-1 | The files belonging to this database system will be owned by user \"postgres\".2024-12-25 10:12:46 db-1 | This user must also own the server process.2024-12-25 10:12:46 db-1 | 2024-12-25 10:12:46 db-1 | The database cluster will be initialized with locale \"en_US.utf8\".2024-12-25 10:12:46 db-1 | The default database encoding has accordingly been set to \"UTF8\".2024-12-25 10:12:46 db-1 | The default text search configuration will be set to \"english\".2024-12-25 10:12:46 db-1 | 2024-12-25 10:12:46 db-1 | Data page checksums are disabled.2024-12-25 10:12:46 db-1 | 2024-12-25 10:12:46 db-1 | initdb: error: could not change permissions of directory \"/var/lib/postgresql/data/pgdata\": Operation not permitted2024-12-25 10:12:46 db-1 | fixing permissions on existing directory /var/lib/postgresql/data/pgdata ... 2024-12-25T02:13:47.405758077Z chmod: /var/lib/postgresql/data/pgdata: Operation not permitted2024-12-25 10:13:47 db-1 | The files belonging to this database system will be owned by user \"postgres\".2024-12-25 10:13:47 db-1 | This user must also own the server process.2024-12-25 10:13:47 db-1 | 2024-12-25 10:13:47 db-1 | The database cluster will be initialized with locale \"en_US.utf8\".2024-12-25 10:13:47 db-1 | The default database encoding has accordingly been set to \"UTF8\".2024-12-25 10:13:47 db-1 | The default text search configuration will be set to \"english\".2024-12-25 10:13:47 db-1 | 2024-12-25 10:13:47 db-1 | Data page checksums are disabled.2024-12-25 10:13:47 db-1 | 2024-12-25 10:13:47 db-1 | initdb: error: could not change permissions of directory \"/var/lib/postgresql/data/pgdata\": Operation not permitted2024-12-25 10:13:48 sandbox-1 | [GIN] 2024/12/25 - 02:13:48 | 200 | 27.609µs | ::1 | GET \"/health\"

1.在 dify/docker 文件夹下找到 docker-compose.yaml

2.找到文件夹中的 volumes/db/data ,替换为 postgres-data

3.最后在末尾,添加上 postgres-data

使用 docker compose up -d 启动容器

docker compose up -d 

输入 docker compose ps可以看到运行的服务

docker compose ps

浏览器上,输入 http://localhost即可访问