一.安装dockor
1.卸载旧版本的dockor
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2.安装依赖环境
yum install -y \
yum-utils \
device-mapper-persistent-data \
lvm2
3.添加dockor软件源
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
4.设置国内dockor源,让下载更加快速
sudo sed -i \
's+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' \
/etc/yum.repos.d/docker-ce.repo
5.安装dockor
yum install -y docker-ce
6.查看dockor版本
docker -v
二.dockor相关命令
systemctl start docker #启动docker服务
systemctl stop docker #停止docker服务
systemctl restart docker #重启docker服务
systemctl status docker #查看docker服务状态
systemctl enable docker #开机启动docker服务
systemctl disable docker #关闭开机启动docker服务
三.设置dockor镜像加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://88y9upwp.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker