docker-compose 安装registry

docker-compose 安装registry

docker-compose.yml

配置文件:

version: '3.1'
services:
  registry:
    image: registry
    container_name: registry
    restart: always
    ports:
      - 5000:5000
    volumes:
      - ./data:/var/lib/registry

启动

docker-compose up -d

访问

curl http://192.168.93.130:5000/v2/
{}

打包docker镜像并上传

docker tag hello-world 192.168.93.130:5000/hw

# 上传
docker push 192.168.93.130:5000/hw
The push refers to repository [192.168.93.130:5000/hw]
Get https://192.168.93.130:5000/v2/: http: server gave HTTP response to HTTPS client
问题

server gave HTTP response to HTTPS client

解决方案

编辑 /etc/docker/daemon.json 文件,如果没有则创建:

vi /etc/docker/daemon.json

# 输入
{
    "insecure-registries": ["192.168.93.130:5000"]
}

# 格式:
{
    "insecure-registries": ["registry的IP地址:端口号"]
}

重启docker服务:

systemctl daemon-reload
systemctl restart docker.service

再次 push 到本地私服:

[root@startsky registry]# docker push 192.168.93.130:5000/hw
The push refers to repository [192.168.93.130:5000/hw]
9c27e219663c: Pushed 
latest: digest: sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042 size: 525
查看私服镜像
[root@startsky es]# curl http://192.168.93.130:5000/v2/_catalog
{"repositories":["hw"]}
拉取私服镜像
[root@startsky registry]# docker pull  192.168.93.130:5000/hw
Using default tag: latest
latest: Pulling from hw
0e03bdcc26d7: Already exists 
Digest: sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042
Status: Downloaded newer image for 192.168.93.130:5000/hw:latest
192.168.93.130:5000/hw:latest
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页