Docker 安装部署
清华源: https://mirror.tuna.tsinghua.edu.cn/help/docker-ce/
1 2
| yum install -y yum-utils device-mapper-persistent-data lvm2
|
1 2
| yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
|
1 2
| sed -i 's+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo
|
1 2 3
| yum makecache fast yum install docker-ce -y
|
1 2 3
| systemctl start docker systemctl enable docker
|
配置镜像加速
1 2 3 4 5 6
| mkdir -p /etc/docker tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://bnxmxzpk.mirror.aliyuncs.com"] } EOF
|
1 2 3
| systemctl daemon-reload systemctl restart docker
|
运行第一个容器
1
| docker run alpine /bin/echo "Hello world"
|