首页 > 技术文章 > docker安装配置

kcxg 2019-04-17 10:16 原文

##########################################
#docker安装配置
#环境centos7
 
#配置docker阿里源
echo '#Docker
[docker-ce-stable]
name=Docker CE - Aliyun
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
'>/etc/yum.repos.d/docker-ce.repo
yum makecache fast
 
#安装必要的系统工具
yum install -y device-mapper-persistent-data lvm2
 
#安装 docker-ce
yum install -y docker-ce
 
#启动docker
systemctl enable docker
systemctl start  docker
 
docker info
docker version
 
#默认镜像源慢,配置镜像加速
#申请阿里云加速地址https://dev.aliyun.com/
#docker阿里云加速配置
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://a0x0e4iy.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
 
 
##########################################
#测试运行 hello-world
docker run hello-world
 
##########################################

 

推荐阅读