首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >码头-合成postgreSQL权限错误

码头-合成postgreSQL权限错误
EN

Stack Overflow用户
提问于 2021-07-14 10:12:20
回答 2查看 4.2K关注 0票数 2

我有一个问题的码头-组成postgreSQL,我正在工作的Windows 2+码头桌面.当我在linux服务器上运行时,效果很好,但是当我尝试在本地启动它时,我会得到下一个错误:

代码语言:javascript
复制
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:

代码语言:javascript
复制
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"

不知道该怎么解决。请救救我!

EN

回答 2

Stack Overflow用户

发布于 2021-07-15 10:37:46

因此,我在这里的猜测是,由于您在WSL中将一个相对于docker文件的目录挂载为"data“目录,权限错误就会发生。您可以尝试修复这些权限(chmod、chown等本地目录)。

您还可以使用“命名”卷 --这也可以解决权限问题。

代码语言:javascript
复制
# docker-compose.yml

services:
  # ...
  db:
    image: postgres:latest
    volumes:
      - "dbdata:/var/lib/postgresql/data"

volumes:
  dbdata:
票数 1
EN

Stack Overflow用户

发布于 2022-09-20 16:28:36

我的解决方案是从Windows启动build,这样权限就没有问题了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68376141

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档