PostgreSQL具有Docker所有权问题 [英] PostgreSQL with docker ownership issue

查看:82
本文介绍了PostgreSQL具有Docker所有权问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从昨天开始,我尝试在Windows(Bootcamp MacBook Pro)上启动docker项目,而我只剩下一个问题:PostgreSQL映像.

Since yesterday, I try to launch my docker project on Windows (Bootcamp MacBook Pro), and I have just one issue left : PostgreSQL image.

错误消息:

postgres_1         | The files belonging to this database system will be owned by user "postgres".
postgres_1         | This user must also own the server process.
postgres_1         |
postgres_1         | The database cluster will be initialized with locale "en_US.utf8".
postgres_1         | The default database encoding has accordingly been set to "UTF8".
postgres_1         | The default text search configuration will be set to "english".
postgres_1         |
postgres_1         | Data page checksums are disabled.
postgres_1         |
postgres_1         | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres_1         | creating subdirectories ... ok
postgres_1         | selecting default max_connections ... 20
postgres_1         | selecting default shared_buffers ... 400kB
postgres_1         | selecting dynamic shared memory implementation ... posix
postgres_1         | creating configuration files ... ok
postgres_1         | 2019-01-22 16:57:37.016 UTC [79] FATAL:  data directory "/var/lib/postgresql/data" has wrong ownership
postgres_1         | 2019-01-22 16:57:37.016 UTC [79] HINT:  The server must be started by the user that owns the data directory.
postgres_1         | child process exited with exit code 1
postgres_1         | initdb: removing contents of data directory "/var/lib/postgresql/data"
postgres_1         | running bootstrap script ... kibati-docker_postgres_1 exited with code 1

我到处搜索,尝试了所有内容,但仍然遇到这个问题……

I've searched everywhere, tried everything, and still have this issue…

我尝试的是:

  • 使用 docker volume create --name postgres -d local 创建Docker卷并在我的docker-compose.yml中使用它
  • Create docker volume with docker volume create --name postgres -d local and use it in my docker-compose.yml

docker-compose.yml

docker-compose.yml

version: '2'

services:
  postgres:
    image: postgres:latest
    ports:
      - "5432:5432"
    volumes:
      - postgres:/var/lib/postgresql/data

  networks:
    internal_ip:
      ipv4_address: 192.168.1.2

  volumes:
    postgres:
      external: true

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆