Centos7.9 安装 Docker 私有仓库

Docker   2023-01-11 19:36   888   0  

系统更新

[root@BJ ~]# yum clean all && yum -y install epel-release && yum makecache && yum -y update

安装docker

[root@BJ ~]# yum -y remove docker*
[root@BJ ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@BJ ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@BJ ~]# yum -y install docker-ce
[root@BJ ~]# systemctl start docker
[root@BJ ~]# systemctl enable docker

官方镜像仓库

yum-config-manager --add-repo http://download.docker.com/linux/centos/docker-ce.repo

更改阿里镜像源(insecure-registries 配置私有仓库)

[root@BJ ~]# cat /etc/docker/daemon.json
{
  "registry-mirrors": ["https://1x0mt0l8.mirror.aliyuncs.com"],
  "insecure-registries": ["registry.9421.ltd:5000","registry.asias.cc:5000","127.0.0.1:5000"]
}
[root@BJ ~]# systemctl restart docker

安装私有仓库(web ui)

[root@BJ ~]# docker run -d -p 5000:5000 --name registry-srv registry
[root@BJ ~]# docker run -d -p 8080:8080 --name registry-web --link registry-srv -e REGISTRY_URL=http://172.17.0.1:5000/v2 -e REGISTRY_NAME=registry.asias.cc:5000 hyper/docker-registry-web

访问地址

[root@mail ~]# curl 127.0.0.1:8080 -I
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=UTF-8
Content-Language: en-US
Content-Length: 2475
Date: Wed, 11 Jan 2023 08:41:08 GMT


博客评论
还没有人评论,赶紧抢个沙发~
发表评论
说明:请文明发言,共建和谐网络,您的个人信息不会被公开显示。