Centos 7安装Docker
2018-11-11 本文已影响72人
QIQIHAL
1 更新yum
[root@localhost ~]# yum update
1.1 如果配置了静态IP,请执行
[root@localhost ~]# echo nameserver 8.8.8.8 > /etc/resolv.conf
[root@localhost ~]# echo nameserver 8.8.4.4 > /etc/resolv.conf
2 编辑docker.repo文件
[root@localhost ~]# vi /etc/yum.repos.d/docker.repo
3 按i粘贴以下代码:复制后一定要对比原文,因为编辑器带格式,复制时容易落下部分内容,复制分后一定要对比原文!!!
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
4 按Esc后,输入wq保存退出
5 安装docker
[root@localhost ~]# yum install docker-engine
6 启动docker
[root@localhost ~]# systemctl start docker
7 开机启动docker
[root@localhost ~]# systemctl enable docker
8 停止docker
[root@localhost ~]# systemctl stop docker