Docker 相关应用(15)-Docker 上安装Registry(docker私服)

安装服务端

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

http://192.168.197.128:5000/v2/

配置客户端

需要在/etc/docker/daemon.json中添加如下内容

{
  "registry-mirrors": [
    "https://registry.docker-cn.com"
  ],
  "insecure-registries": [
    "192.168.199.100:5000"
  ]
}

重启docker

$ systemctl restart docker

查看是否配置成功

$ docker info
# Insecure Registries:
# 192.168.197.128:5000

测试镜像上传

$ docker pull tomcat
$ docker tag tomcat 192.168.197.128:5000/tomcat
$ docker push 192.168.197.128:5000/tomcat

http://192.168.197.128:5000/v2/_catalog

http://192.168.197.128:5000/v2/tomcat/tags/list

部署Docker-Registry-WebUI

docker-registry-frontend

version: '3.1'
services:
  frontend:
    image: konradkleine/docker-registry-frontend:v2
    ports:
      - 8080:80
    volumes:
      - ./certs/frontend.crt:/etc/apache2/server.crt:ro
      - ./certs/frontend.key:/etc/apache2/server.key:ro
    environment:
      - ENV_DOCKER_REGISTRY_HOST=192.168.197.141
      - ENV_DOCKER_REGISTRY_PORT=5000

http://192.168.197.141:8080/repository/tomcat

你可能感兴趣的:(Docker 相关应用(15)-Docker 上安装Registry(docker私服))