这些天研究如何模块化开发,于是折腾起了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!