我有一个问题的码头-组成postgreSQL,我正在工作的Windows 2+码头桌面.当我在linux服务器上运行时,效果很好,但是当我尝试在本地启动它时,我会得到下一个错误:
postgres | chmod: changing permissions of '/var/lib/postgresql/data': Operation not permitted
ngnix | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
postgres | The files belonging to this database system will be owned by user "postgres".
postgres | This user must also own the server process.
postgres |
postgres | The database cluster will be initialized with locale "en_US.utf8".
postgres | The default database encoding has accordingly been set to "UTF8".
postgres | The default text search configuration will be set to "english".
postgres |
postgres | Data page checksums are disabled.
postgres |
ngnix | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
ngnix | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
postgres | fixing permissions on existing directory /var/lib/postgresql/data ... initdb: error: could not change permissions of directory "/var/lib/postgresql/data": Operation not permitted
ngnix | /docker-entrypoint.sh: Configuration complete; ready for start up
postgres exited with code 1我试图更改像=> chmod 777 -R project_folder这样的所有项目的权限
Dcoker-compose.yml:
postgresdb:
container_name: postgres
build:
context: ./docker/postgres
dockerfile: Dockerfile
environment:
- POSTGRES_PASSWORD=password123
volumes:
- ./docker/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"不知道该怎么解决。请救救我!
发布于 2021-07-15 10:37:46
因此,我在这里的猜测是,由于您在WSL中将一个相对于docker文件的目录挂载为"data“目录,权限错误就会发生。您可以尝试修复这些权限(chmod、chown等本地目录)。
您还可以使用“命名”卷 --这也可以解决权限问题。
# docker-compose.yml
services:
# ...
db:
image: postgres:latest
volumes:
- "dbdata:/var/lib/postgresql/data"
volumes:
dbdata:发布于 2022-09-20 16:28:36
我的解决方案是从Windows启动build,这样权限就没有问题了。
https://stackoverflow.com/questions/68376141
复制相似问题