我拼命想要获得一个我继承并运行的Docker项目,而Docker却没有给我带来任何问题.尝试启动我的容器时,我在Postgresql容器上收到以下错误:
FATAL: "/var/lib/postgresql/data" is not a valid data directory
DETAIL: File "/var/lib/postgresql/data/PG_VERSION" does not contain valid data.
HINT: You might need to initdb.
Run Code Online (Sandbox Code Playgroud)
该项目是一个使用Redis,ElasticSearch和Sidekiq容器的Rails项目 - 所有这些都很好.
泊坞窗,compose.yml:
postgres:
image: postgres:9.6.2
environment:
POSTGRES_USER: $PG_USER
POSTGRES_PASSWORD: $PG_PASS
ports:
- '5432:5432'
volumes:
- postgres:/var/lib/postgresql/data
Run Code Online (Sandbox Code Playgroud)
/var/lib/postgresql/data 由postgres用户拥有(因为我应该相信)并且postgresql服务启动并且可以自行运行.
我试过initdb从/usr/lib/postgresql/9.6/bin目录运行,以及从docker运行(从docker它似乎不会持续甚至创建任何东西......如果有人知道我为什么会有兴趣知道)
/var/lib/postgresql/data目录的内容:
drwxrwxrwx 19 postgres postgres 4096 Jun 28 20:41 .
drwxr-xr-x 5 postgres postgres 4096 Jun 28 20:41 ..
drwx------ 5 postgres postgres 4096 Jun 28 20:41 base
drwx------ 2 postgres …Run Code Online (Sandbox Code Playgroud)