安装docker后启动报错


安装docker后启动报错

1)、启动后提示

[root@localhost ~]# systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

2)、查看运行状态

[root@localhost ~]# systemctl status docker
● docker.service - Docker Application Container Engine
  Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
  Active: failed (Result: exit-code) since Wed 2019-06-05 02:41:17 EDT; 4min 0s ago
    Docs: http://docs.docker.com
Process: 4999 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=1/FAILURE)
Main PID: 4999 (code=exited, status=1/FAILURE)

Jun 05 02:41:15 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
Jun 05 02:41:15 localhost.localdomain dockerd-current[4999]: time="2019-06-05T02:41:15.811648461-04:00" level=warning msg="could not change group /var/run/docker.sock to docker: ...not found"
Jun 05 02:41:15 localhost.localdomain dockerd-current[4999]: time="2019-06-05T02:41:15.826445566-04:00" level=info msg="libcontainerd: new containerd process, pid: 5006"
Jun 05 02:41:16 localhost.localdomain dockerd-current[4999]: time="2019-06-05T02:41:16.841103310-04:00" level=warning msg="overlay2: the backing xfs filesystem is formatted without d_type ...
Jun 05 02:41:17 localhost.localdomain dockerd-current[4999]: Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a new...led=false)
Jun 05 02:41:17 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jun 05 02:41:17 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Jun 05 02:41:17 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Jun 05 02:41:17 localhost.localdomain systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

注意报错中有这样一个提示

Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a new...led=false)

由此可以判断是因为SELinux开启导致

3)、查看SELinux是否开启

[root@localhost ~]# getenforce
Enforcing

显示Enforcing 说明SELinux开启

4)、关闭SELinux

a、临时关闭
[root@localhost ~]# getenforce
Enforcing

[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
b、永久关闭

修改配置文件,将其永久关闭,如下

[root@localhost ~]# vi /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

5)、重启系统

[root@localhost ~]# reboot

6)、启动docker

[root@localhost ~]# systemctl start docker
#[root@localhost ~]# systemctl status docker
● docker.service - Docker Application Container Engine
  Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
  Active: active (running) since Wed 2019-06-05 03:08:45 EDT; 48s ago
    Docs: http://docs.docker.com
Main PID: 2996 (dockerd-current)
  CGroup: /system.slice/docker.service
          ├─2996 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland...
          └─3001 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libc...

Jun 05 03:08:44 localhost.localdomain dockerd-current[2996]: time="2019-06-05T03:08:44.576076584-04:00" level=info msg="Loading containers: start."
Jun 05 03:08:44 localhost.localdomain dockerd-current[2996]: time="2019-06-05T03:08:44.618340992-04:00" level=warning msg="Running modprobe bridge br_netfilter failed with message: modprob...
Jun 05 03:08:44 localhost.localdomain dockerd-current[2996]: time="2019-06-05T03:08:44.699255570-04:00" level=info msg="Firewalld running: false"
Jun 05 03:08:45 localhost.localdomain dockerd-current[2996]: time="2019-06-05T03:08:45.004286625-04:00" level=info msg="Default bridge (docker0) is assigned with an IP address 17...P address"
Jun 05 03:08:45 localhost.localdomain dockerd-current[2996]: time="2019-06-05T03:08:45.151691070-04:00" level=info msg="Loading containers: done."
Jun 05 03:08:45 localhost.localdomain dockerd-current[2996]: time="2019-06-05T03:08:45.152971851-04:00" level=warning msg="Not using native diff for overlay2, this may cause degr...er to fix"
Jun 05 03:08:45 localhost.localdomain dockerd-current[2996]: time="2019-06-05T03:08:45.207253928-04:00" level=info msg="Daemon has completed initialization"
Jun 05 03:08:45 localhost.localdomain dockerd-current[2996]: time="2019-06-05T03:08:45.207276621-04:00" level=info msg="Docker daemon" commit="b2f74b2/1.13.1" graphdriver=overlay...ion=1.13.1
Jun 05 03:08:45 localhost.localdomain systemd[1]: Started Docker Application Container Engine.
Jun 05 03:08:45 localhost.localdomain dockerd-current[2996]: time="2019-06-05T03:08:45.216223753-04:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM