前言
新机器安装docker的时候,发现了一些安装时候的问题。整理如下
问题: Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel
场景:
安装完毕后,使用systemctl
命令启动docker
的时候,启动失败
解决方案:
百度搜了说修改SELinux ,而SELinux是个安全程序,所以升级了内核,具体操作如下:
[root@localhost ~]# yum -y install kernel
重点
:安装完毕后记得重启、重启、重启
再启动docker,启动成功。
也可以通过命令uname -a
查看前后的内核版本变化。
[root@localhost ~]# systemctl start docker
[root@localhost ~]#
问题:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
场景:
在使用命令systemctl start docker
启动以后,再使用docker命令(如:docker ps
)时报这个错。
解决方案:
修改systemctl的docker配置文件,命令:
vi /usr/lib/systemd/system/docker.service
修改此处为以下内容:
问题解决,重新使用docker命令,如下:
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@localhost ~]#
docker-proxy-current 8080端口占用问题
解决方案:
修改docker配置文件,命令:
vi /etc/systemd/system/multi-user.target.wants/docker.service
修改启动行命令为:
ExecStart=/usr/bin/docker-current daemon --tls=false -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock \
截图如下:
然后执行以下命令:
systemctl daemon-reload
重新启动docker即可。