我正尝试按照docker hub中的说明启动一个postgres实例。
为此,我运行了以下命令:
sudo docker run --name database -e POSTGRES_PASSWORD=supersecret -p 5432:5432 -d postgres
当我运行docker ps
时,它什么都不显示,而当我运行docker ps -a
时,它显示:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
967ebe7efb74 postgres "docker-entrypoint.s…" 2 minutes ago Exited (1) 2 minutes ago database
尝试docker start database
也会导致STATUS Exited (1)
,如上所示。
以下是docker logs -f database
显示的日志:
PostgreSQL init process complete; ready for start up.
2019-09-10 14:08:26.941 UTC [1] LOG: could not create IPv6 socket for address "::": Permission denied
2019-09-10 14:08:26.941 UTC [1] LOG: could not create IPv4 socket for address "0.0.0.0": Permission denied
2019-09-10 14:08:26.941 UTC [1] WARNING: could not create listen socket for "*"
2019-09-10 14:08:26.941 UTC [1] FATAL: could not create any TCP/IP sockets
2019-09-10 14:08:26.941 UTC [1] LOG: database system is shut down
在我为解决此问题而在互联网上进行的研究中,有人说这可能与我的主机文件有关,但似乎如下所示。
127.0.0.1 localhost
127.0.1.1 user-PC
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
我尝试按照docker docs的逐步教程重新安装docker,并且我也做了post installation steps,但没有成功。
操作系统:Deepin GNU / Linux 15.11 Docker:Docker版本18.09.6,内部版本481bc77
答案 0 :(得分:1)
由于您已确认,因此我将评论写为答案。
问题归因于 apparmor 。 尝试禁用它,或者更好地配置安全配置文件