Docker学习之1-----linux上安装docker

系统:centos7
docker组成:
(1)Docker Client客户端:Docker命令
(2)Docker Daemon守护进程,其实这就是一个Docker的服务
(3)Docker Image镜像模板:分层结构
(4)Docker Container容器,运行image镜像后就成了这个镜像的容器
linux上安装docker:

yum install docker

关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service  永久关闭防火墙

启动防docker

systemctl start docker
systemctl enable docker 开机自启

启动的时候报了一个错误

[root@localhost pluginconf.d]# 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.

这个意思是说docker服务的任务启动四百,因为一个错误码退出了进程。如果想查看详细原因执行systemctl status docker.service或者是journalctl -xe名就可以查看详细情况。
然后我们执行了systemctl status docker.service

[root@localhost pluginconf.d]# systemctl status docker.service
鈼[0m docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2021-07-11 15:46:59 CST; 19s ago
     Docs: http://docs.docker.com
  Process: 42109 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: 42109 (code=exited, status=1/FAILURE)

Jul 11 15:46:58 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
Jul 11 15:46:58 localhost.localdomain dockerd-current[42109]: time="2021-07-11T15:46:58.481602120+08:00" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
Jul 11 15:46:58 localhost.localdomain dockerd-current[42109]: time="2021-07-11T15:46:58.496327895+08:00" level=info msg="libcontainerd: new containerd process, pid: 42114"
Jul 11 15:46:59 localhost.localdomain dockerd-current[42109]: 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 (...-enabled=false)
Jul 11 15:46:59 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jul 11 15:46:59 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Jul 11 15:46:59 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Jul 11 15:46:59 localhost.localdomain systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

在这个日志中的一个关键信息是level=warning msg=“could not change group /var/run/docker.sock to docker: group docker not found”
用这段代码去网上一搜就能解决问题
在docker的配置文件/etc/sysconfig/docke 中设置禁用selinux。
在这里插入图片描述在这里插入图片描述
然后执行systemctl start docker 就可正常启动了,随后docker的守护进程服务就启动了
随后我们使用docker version或者docker info就可以查看docker的版本号或者其他详细信息了

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

枣泥馅

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

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

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

打赏作者

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

抵扣说明:

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

余额充值