Docker Private Warehouse Building

Source: Internet
Author: User
Tags mkdir openssl docker run docker registry
Installing Docker
===================
1. sudo apt-get update
2. Curl-fssl HTTPS://DOWNLOAD.DOCKER.COM/LINUX/UBUNTU/GPG | sudo apt-key add-
3. Sudo add-apt-repository "Deb [ARCH=AMD64] Https://download.docker.com/linux/ubuntu $ (lsb_release-cs) stable"
4. sudo apt-get update
5. sudo apt-get-y install Docker-ce
6. Docker Run Hello-world # Verify that the Docker installation is correct
7. Sudo systemctl enable Docker # self-booting


Installing registry
===================
1. Docker Pull Registry:2
2. Docker run-d-P 5000:5000--restart=always-v/data/docker/registry/:/var/lib/registry/--name Registry Registry:2
3. Docker Pull Hello-world
4. Docker tag Hello-world 127.0.0.1:5000/hello-world
5. Docker Push 127.0.0.1:5000/hello-world
6. Docker Pull 127.0.0.1:5000/hello-world


Set up server TLS authentication
===================
1. In general, the certificate only supports domain name access, to enable it to support IP address access, you need to modify the configuration file OPENSSL.CNF. Under the Ubuntu system:
sudo vim/etc/ssl/openssl.cnf added under [V3_ca]: SubjectAltName = ip:192.168.9.26
2. Generate a self-signed certificate:
1. Sudo mkdir-p/data/docker/tls_certs
2. Cd/data/docker/tls_certs
3. sudo openssl req-x509-days 3650-nodes-newkey rsa:2048-keyout docker_reg.key-out docker_reg.crt-subj "/C=CN/ST=BJ /l=beijing/cn=192.168.9.26:5000 "
4. Run Docker Registry
Docker run-d--name docker-registry-no-proxy--restart=always-u root-p 5000:5000-v/data/docker/registry/:/var/lib/re Gistry-v/data/docker/tls_certs:/certs-e registry_http_tls_certificate=/certs/docker_reg.crt-e REGISTRY_HTTP_TLS_ Key=/certs/docker_reg.key Registry:2


Set up Client TLS authentication
===================
1. Sudo mkdir-p/etc/docker/certs.d/192.168.9.26:5000/
2. sudo cp docker_reg.crt/etc/docker/certs.d/192.168.9.26:5000/ca.crt


Using a private warehouse
===================
1. Download an image from Docker:
Docker Pull Hello-world
2. Label the image as a private warehouse:
Docker tag Hello-world 192.168.9.26:5000/hello-world
3. Push it to the private repository:
Docker Push 192.168.9.26:5000/hello-world
4. Download the image from the private repository:
Docker Pull 192.168.9.26:5000/hello-world

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.