Linux 跑 Docker,卡壳,求解。

2018-12-26 22:44:33 +08:00
 maleclub

用 Docker 跑 postgrestSQL,无法顺利创建启动服务。

$ sudo docker run --name TestByAnna -d -p 55555:5432 -v /volume1/testforsql:/var/lib/postgresql/data -e POSTGRES_DB=TestByAnna -e POSTGRES_USER=anna -e POSTGRES_PASSWORD='PASSWORDbyme' postgres:latest

日志输出如下,求指点。万分感谢。

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

initdb: directory "/var/lib/postgresql/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgresql/data" or run initdb
with an argument other than "/var/lib/postgresql/data".
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

initdb: directory "/var/lib/postgresql/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgresql/data" or run initdb
with an argument other than "/var/lib/postgresql/data".
2886 次点击
所在节点    Linux
5 条回复
fullpowers
2018-12-26 22:52:22 +08:00
把 /volume1/testforsql 清空试试
yghack
2018-12-26 22:53:32 +08:00
挂个空目录上去吧,提示已经说的很明确了,目录非空,无法初始化
maleclub
2018-12-26 23:25:51 +08:00
@fullpowers 好的,感谢你的帮助,已经解决。。
maleclub
2018-12-26 23:26:09 +08:00
@yghack 果然是这样,感谢
julyclyde
2018-12-27 11:48:29 +08:00
这不是没事找事么
不用 docker,改用正规安装,就没这问题了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/521334

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX