SpringBoot系列-Docker安装,启动,停止

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ytuglt/article/details/84701633

1.检查centos版本

Docker要求CentOS系统内核版本高于3.10
输入下面的命令查看版本:

[root@bogon ~]# uname -r

2.安装docker

[root@bogon ~]# yum install docker

3.docker启动

执行下面命令启动docker:

[root@bogon ~]# systemctl start docker

会发现有下面报错信息

[root@bogon ~]# 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.
[root@bogon ~]# syetemctl status docker.service -l
-bash: syetemctl: command not found
[root@bogon ~]# systemctl status docker.service -l
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sat 2018-12-01 21:50:58 EST; 28s ago
     Docs: http://docs.docker.com
  Process: 19160 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: 19160 (code=exited, status=1/FAILURE)

Dec 01 21:50:57 bogon systemd[1]: Starting Docker Application Container Engine...
Dec 01 21:50:57 bogon dockerd-current[19160]: time="2018-12-01T21:50:57.221407793-05:00" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
Dec 01 21:50:57 bogon dockerd-current[19160]: time="2018-12-01T21:50:57.227779845-05:00" level=info msg="libcontainerd: new containerd process, pid: 19165"
Dec 01 21:50:58 bogon dockerd-current[19160]: time="2018-12-01T21:50:58.240205766-05:00" level=warning msg="overlay2: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior. Reformat the filesystem with ftype=1 to enable d_type support. Running without d_type support will no longer be supported in Docker 1.16."
Dec 01 21:50:58 bogon dockerd-current[19160]: Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a newer kernel or disable selinux in docker (--selinux-enabled=false)
Dec 01 21:50:58 bogon systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Dec 01 21:50:58 bogon systemd[1]: Failed to start Docker Application Container Engine.
Dec 01 21:50:58 bogon systemd[1]: Unit docker.service entered failed state.
Dec 01 21:50:58 bogon systemd[1]: docker.service failed.

遇到这个问题不要慌张,下面来解决一下:
打开docker配置文件,

[root@bogon ~]# vi /etc/sysconfig/docker

在这里插入图片描述
将如图中所标识的地方,修改位false,修改后如下图所示:
在这里插入图片描述

再次执行:[root@bogon ~]# systemctl start docker
就会发现不报错了
查看docker版本号:

[root@bogon ~]# docker -v
Docker version 1.13.1, build 8633870/1.13.1

配置docker为开机自动启动:

[root@bogon ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

4.停止docker

[root@bogon ~]# systemctl stop docker

猜你喜欢

转载自blog.csdn.net/ytuglt/article/details/84701633