目录

Registry

配置hosts

sudo nano /etc/hosts
10.10.10.10    HOSTNAME

运行registry

docker pull registry:2

sudo docker run -d \
    -p 5000:5000 \
    -v /home/ailab/docker-registry:/var/lib/registry \
    --restart=always \
    --name docker-registry \
    registry:2

修改Docker配置

sudo nano /etc/docker/daemon.json
{
    "live-restore": true,
    "group": "dockerroot",
    "insecure-registries": ["HOSTNAME:5000"]
}

重启Docker Engine

sudo systemctl restart docker

推送镜像

sudo docker tag hello-world:latest HOSTNAME:5000/hello-world:latest
sudo docker push HOSTNAME:5000/hello-world:latest

Registry UI

Docker Registry Frontend

  • 部署
    sudo docker pull konradkleine/docker-registry-frontend:v2
    sudo docker run -d \
      -e ENV_DOCKER_REGISTRY_HOST=10.10.10.10 \
      -e ENV_DOCKER_REGISTRY_PORT=5000 \
      -p 8080:80 \
      --name docker-registry-frontend \
      konradkleine/docker-registry-frontend:v2
    
  • 浏览器访问
    http://HOSTNAME:8080
    

Docker Registry Web

  • 部署
    sudo docker pull hyper/docker-registry-web:latest
    docker run -d \
      --link docker-registry \
      -e REGISTRY_URL=http://docker-registry:5000/v2 \
      -e REGISTRY_NAME=HOSTNAME:5000 \
      -p 8080:8080 \
      --name docker-registry-web \
      hyper/docker-registry-web 
    
  • 浏览器访问
    http://HOSTNAME:8080
    

客户机

配置hosts

sudo nano /etc/hosts
10.10.10.10    HOSTNAME

修改Docker配置

sudo nano /etc/docker/daemon.json
{
    "live-restore": true,
    "group": "dockerroot",
    "insecure-registries": ["HOSTNAME:5000"]
}

拉取镜像

sudo docker pull HOSTNAME:5000/hello-world:latest