1. Install the Docker engine and start the Docker service 2. generate the self-visa book, the script is as follows crt.sh: #!/bin/bash # generate self-visa book script #common name default is host name #CN = ' hostname ' cn= ' Docker.repo ' #证书名 crtname= ' Registry ' mkdir certs;cd certs openssl req -x509 -days 3650 -subj "/ cn=${cn}/" -nodes -newkey rsa:4096 -sha256 -keyout ${crtname}.key -out ${CrtName}.crt3. download Docker-compose (container): $ curl -l https:// github.com/docker/compose/releases/download/1.7.0/run.sh > /usr/local/bin/docker-compose4. Writing Docker-compose.yml registry_web: image : ' Hyper/docker-registry-web ' ports: - "80:8080" restart: always links: - registry environment: - REGISTRY_HOST=registry - REGISTRY_PORT=5000 - TRUST_ANY_SSL=true registry: image: ' Registry : 2.2.1 ' ports: - " 443:5000 " restart: always volumes: - ./ certs:/certs - /dockrepo:/var/lib/ registry environment: - REGISTRY_HTTP_TLS_CERTIFICATE=/certs/registry.crt - REGISTRY_HTTP_TLS_KEY=/certs/registry.key - REGISTRY_STORAGE_DELETE_ENABLED=true 5. The docker-compose up -d 6. client needs to do is: 1. copy Registry.crt to/etc/ Docker/certs.d/docker.Repo (that is, the CN specified when the certificate was created)/ 2. echo ' Registry_ip docker.repo ' >> /etc/hosts 7. push and pull mirrors, Eg: docker push docker.repo/busybox docker pull docker.repo/busybox8. can be accessed via a browser, View the image in registry: http://docker.repo/
This article is from the "Everything Possible" blog, please be sure to keep this source http://noican.blog.51cto.com/4081966/1769825
Enterprise Self-use Docker Registry V2 mirrored Warehouse