一. 检查Linux内核版本,CenterOS7安装docker要求内核版本在3.10以上:uname  -r

二. 使用yum命令安装:yum install docker

三. 启动Docker:service docker start(最好使用systemctl start docker替代service docker start,原因见另一篇博客:https://blog.csdn.net/yzh_1346983557/article/details/84943287

报错: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,看到的日志信息:

原因:是由于docker不支持图像内核驱动,不支持SELinux这个内核上的OrthALA2图形驱动程序。

解决办法:修改docker配置文件:vim  /etc/sysconfig/docker ,把OPTIONS一行改为:

OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'

按下“Esc”,输入“:wq”保存退出vim编辑模式,再启动:service docker start就ok了。

四. 使用docker运行helloworld:docker run hello-world

补充:

    查看版本: docker -v
    开机启动docker: systemctl enable docker

    停止docker:  systemctl stop docker

   

 

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐