安装dockers

Docker安装部署
2.1 国内源安装docker-ce
这里我们使用清华源:
https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/
操作步骤:

yum remove docker docker-common docker-selinux docker-engine
yum install -y yum-utils device-mapper-persistent-data lvm2
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
sed -i 's#download.docker.com#mirrors.tuna.tsinghua.edu.cn/docker-ce#' /etc/yum.repos.d/docker-ce.repo

更新yum缓存

yum makecache fast
yum install docker-ce -y
docker version
systemctl start docker

上传安装包,
yum localinstall '*.rpm'
2.2 国内远镜像加速配置
官网地址
https://www.daocloud.io/mirror
加速命令
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
需要重启docker
阿里镜像加速地址
https://cr.console.aliyun.com/cn-hangzhou/instances/repositories
加速命令
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://ig2l319y.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
2.3 快速安装
思路:
1.开启yum缓存
2.全新环境安装docker
3.将缓存的包全部打包出来
4.安装的时候使用rpm -ivh *.rpm方式安装

2.4 运行第一个容器
运行一个Hello world

docker run alpine /bin/echo "Hello world"

posted on 2022-08-06 17:39  酷gril  阅读(95)  评论(0编辑  收藏  举报