docker基础02:安装docker-ce

SRE技术栈  ·  2020-10-20

系统:centos7.x

centos6.x下安装见这里

1. 清理旧版,如果是新安装跳过即可

#清理防火墙和虚拟网卡
iptables -t nat -F 
ip link set docker0 down 
ip link delete docker0

# 卸载旧版本docker
yum remove docker docker-common container-selinux docker-selinux docker-engine

2. 安装docker(使用了aliyun源)

1 centos7.x系统

yum install -y yum-utils #
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast   #不是必须的
yum  install docker-ce -y

2 Ubuntu系统

add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add -
apt-get install docker-ce

3. 启动docker 服务

systemctl start docker      #启动
systemctl enable docker  #设置开机自动启动

到此,安装完毕啦

 
评论
Glab. All Rights Reserved. Theme Jasmine by Kent Liao.