如何轻松启动Docker服务

这些天研究如何模块化开发,于是折腾起了Docker,发现它有点皮,根据官网的教程安装后运行sudo systemctl start docker。结果,他跑不起来。他跑不起来如何让我Hello world呢?

(base) [steven@localhost ~]$ sudo systemctl start docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xeu docker.service" for details.

执行journalctl -xeu docker.service

Jul 07 20:10:56 localhost.localdomain systemd[1]: docker.service: Start request repeated too quickly.
Jul 07 20:10:56 localhost.localdomain systemd[1]: docker.service: Failed with result ‘exit-code‘.

解决方案

网上大多是改deamon.json或是执行sudo rm -rf /var/lib/docker,我试了之后没什么效果。还好有万能的Bing在stack overflow里找到了一个靠谱的。(62的useful)

(base) [steven@localhost ~]$ firewall-cmd --get-active-zones
FedoraWorkstation
interfaces: ens33
libvirt
interfaces: virbr0
trusted
interfaces: docker0
(base) [steven@localhost ~]$ sudo firewall-cmd --zone=docker --change-interface=docker0
success
(base) [steven@localhost ~]$ firewall-cmd --get-active-zones
FedoraWorkstation
interfaces: ens33
docker
interfaces: docker0
libvirt
interfaces: virbr0
(base) [steven@localhost ~]$ sudo systemctl start docker # 这里建议间隔一段时间,再执行

看可爱的Hello world出来了:

(base) [steven@localhost ~]$ sudo docker run hello-world

Hello from Docker!

引用

如何轻松启动Docker服务

上一篇:grpc C# 应用


下一篇:首次打开Word2016时,总是提示“很抱歉,,此功能看似已中断,并需要修复。请使用Windows控制面板中的“程序与功能”选项修复Microsoft Office”