1. 安装docker依赖包
bash
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl status docker
sudo systemctl start docker
sudo systemctl restart docker
docker push ip:5000/image:latest
docker pull ip:5000/image:latest
2.配置docker镜像源
bash
sudo vim /etc/docker/daemon.json
{
"registry-mirrors": [
"https://dockerproxy.com",
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com",
"https://ccr.ccs.tencentyun.com",
"https://registry.docker-cn.com",
"https://docker.nju.edu.cn",
"https://docker.mirrors.ustc.edu.cn",
"https://yxzrazem.mirror.aliyuncs.com",
"https://docker.kubesre.xyz",
"https://dc.j8.work",
"https://docker.registry.cyou",
"https://docker.hlyun.org",
"https://docker.chenby.cn",
"https://docker.jsdelivr.fyi",
"https://docker-mirrors.mjjman.com",
"https://huecker.io",
"https://dockerhub.timeweb.cloud",
"https://docker-cf.registry.cyou",
"https://dockercf.jsdelivr.fyi",
"https://dockertest.jsdelivr.fyi"
]
}
2.安装私有仓库
1) 命令行方式安装
docker pull registry
docker run -d -p 5000:5000 -v /root/data/registry:/var/lib/registry
--restart=always --name registry registry
docker pull registry.cn-beijing.aliyuncs.com/google_registry/docker-registry-web:latest
docker run -d -p 5001:8080 --name registry-web --restart=always --link registry
-e registry_url=http://xxxx:5000/v2
-e registry_name=http://xxxx:5000
registry.cn-beijing.aliyuncs.com/google_registry/docker-registry-web
1) compose方式安装, 执行compose文件,文件详情见附件
bash
curl -L https://github.com/docker/compose/releases/download/1.21.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
mv docker-compose /usr/local/bin
chmod +x /usr/local/bin/docker-compose
docker-compose -v
docker-compose up -d