关于使用SmarTTY在linux虚拟机Centos7系统安装docker遇到的坑

1、检查内核版本,必须是3.10及以上

uname -r

2、安装docker

yum install docker

3、输入y确认安装
4、启动docker

[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.

systemctl status docker.service查看原因:

[root@localhost ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2020-04-07 23:31:15 EDT; 11min ago
     Docs: http://docs.docker.com
  Process: 5033 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: 5033 (code=exited, status=1/FAILURE)

Apr 07 23:31:13 localhost.localdomain systemd[1]: Starting Docker Applicatio...
Apr 07 23:31:13 localhost.localdomain dockerd-current[5033]: time="2020-04-0...
Apr 07 23:31:13 localhost.localdomain dockerd-current[5033]: time="2020-04-0...
Apr 07 23:31:14 localhost.localdomain dockerd-current[5033]: time="2020-04-0...
Apr 07 23:31:15 localhost.localdomain dockerd-current[5033]: Error starting ...
Apr 07 23:31:15 localhost.localdomain systemd[1]: docker.service: main proce...
Apr 07 23:31:15 localhost.localdomain systemd[1]: Failed to start Docker App...
Apr 07 23:31:15 localhost.localdomain systemd[1]: Unit docker.service entere...
Apr 07 23:31:15 localhost.localdomain systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

解决方案:

# vi /etc/sysconfig/docker

然后出现:

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

# Do not add registries in this file anymore. Use /etc/containers/registries.conf
# instead. For more information reference the registries.conf(5) man page.

# Location used for temporary files, such as those created by
# docker load and build operations. Default is /var/lib/docker/tmp
# Can be overriden by setting the following environment variable.
# DOCKER_TMPDIR=/var/tmp

# Controls the /etc/cron.daily/docker-logrotate cron job status.
# To disable, uncomment the line below.
# LOGROTATE=false

# docker-latest daemon can be used by starting the docker-latest unitfile.
# To use docker-latest client, uncomment below lines

先将OPTIONS里的–selinux-enabled后面加上"=false",变成:

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

由于博主是刚刚接触这个,并不知道如何编辑,如何保存,退出,花了不少时间瞎弄。。。
按“A”键进入编辑,想要保存退出:先按Esc键,然后打出“:wq”,回车就行了。
重新启动:

# systemctl restart docker

5、开机启动docker

[root@localhost ~]# systemctl enable docker

6、停止docker

systemctl stop docker

问题解决了请点个赞,谢谢了。

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 9
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

console.log("")

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值