CentOS7 已经内置了docker ,能够直接安装html
安装Dockerlinux
命令: sudo yum install -y dockerdocker
启动docker json
命令: service docker startvim
发现会出现异常阿里云
没法启动:
按照提示执行:
命令: systemctl status docker.servicespa
这是因为overlay2不支持形成的,因此咱们要关闭它3d
命令: vim /etc/sysconfig/docker rest
进入修改配置 selinux-enabled=falsecode
再次执行 service docker start
执行命令: docker -v
启动成功。
修改Docker镜像加速器
国外的docker镜像访问速度太慢 因此咱们能够修改为阿里的docker镜像。这样速度会快不少。
1.打开阿里云docker仓库地址https://dev.aliyun.com/search.html
2.淘宝帐号便可登陆,登陆后点击本身的管理中心。
3.点击管理中心左侧菜单栏的“镜像加速器”,右边面板会有你的加速地址,面板下面有详细设置步骤。以下图:
root@localhost ~]# vi /etc/docker/daemon.json
将下面整行字符拷贝进去,保存并退出
"registry-mirrors": ["https://xrij41fy.mirror.aliyuncs.com"]
:wq!
刷新daemon
[root@localhost ~]# systemctl daemon-reload
重启docker
[root@localhost ~]# systemctl restart docker
拉取镜像
以hello-world为例
[root@localhost tmp]# docker pull hello-world Using default tag: latest Trying to pull repository docker.io/library/hello-world ... latest: Pulling from docker.io/library/hello-world 9bb5a5d4561a: Pull complete Digest: sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77 Status: Downloaded newer image for docker.io/hello-world:latest
表示成功拉取
运行镜像
[root@localhost tmp]# docker run hello-world