BlueXIII's Blog

热爱技术,持续学习

0%

K8S离线部署笔记-4-Registry

Rigistry

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 在线环境
docker pull docker.io/registry
docker save -o registry.tar registry

# 离线环境
docker load -i registry.tar

# 启动
docker run \
-d \
-p 5000:5000 \
-v /var/lib/registry:/var/lib/registry \
--restart=always \
--name docker-registry \
registry

# 允许HTTP访问
vi /etc/docker/daemon.json
{ "insecure-registries":["10.10.51.77:5000","registry.yourcompany.com:5000"] }

systemctl daemon-reload & systemctl restart docker

# Push镜像
docker pull nginx
docker tag nginx 10.10.51.77:5000/nginx
docker push 10.10.51.77:5000/nginx

UI

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 在线环境
docker pull konradkleine/docker-registry-frontend:v2
docker save -o docker-registry-frontend.tar konradkleine/docker-registry-frontend:v2

# 离线环境
docker load -i docker-registry-frontend.tar

# 启动
docker run \
-d \
-e ENV_DOCKER_REGISTRY_HOST=10.10.51.77 \
-e ENV_DOCKER_REGISTRY_PORT=5000 \
-p 8080:80 \
--restart=always \
--name docker-registry-frontend \
konradkleine/docker-registry-frontend:v2

# 浏览器访问
http://10.10.51.77:8080

迁移

1
2
3
# 打包整个目录
cd /var/lib/registry
tar -zcvf docker.tar.gz docker