Docker Learning (8) building a private warehouse on Mac machines

Source: Internet
Author: User
Tags ssl certificate docker hub docker run docker registry

Docker's private warehouse, like Maven's, is typically used to build a docker hub-like environment within the company, so uploading and downloading mirrors are faster, and this article demonstrates how to use Docker-machine on a Mac to build a private warehouse without SSL certificates.

One, view docker-machine virtual machine IP

Docker-machine IP Default

By default, the virtual machine name created by Docker-toolbox is default, and if your virtual machine name is not this, the last default of the above command is replaced with the real virtual machine name, assuming that the default assigned IP is 192.168.99.100

Second, modify the Docker boot configuration in the virtual machine

Because the latest version of Docker enforces an SSL secure connection when it is the default access, but generally internal applications do not require such a high level of security, refer to the following practices to reduce security settings:

Docker-machine ssh Defaultsudo Vi/var/lib/boot2docker/profile

At the end of the profile, add:

extra_args= "--insecure-registry 192.168.99.100:5000"

Then exit the default, and enter the following command to restart the virtual machine

Docker-machine Restart Default

Third, create a container

DAO Pull Registry Docker run-d-P 5000:5000--restart=always-h Registry--name Registry  -v/users/yjmyzz/data/re Gistry:/tmp/registry  Registry

The DAO pull registry on line 1th indicates that the registry mirror will be pulled from the Daocloud.io, which can be omitted if the mirror is already present on the machine.

The path after-V is changed to the actual path, and this directory is used to store the images file for push to the private repository.

Iv. test Upload, download

4.1 First pull a hello-world from the Daocloud.io.

Hello-world This image only 960b, you can take this practiced hand

DAO Pull Hello-world

4.2 Label the Hello-world as a mirror

Docker tag Hello-world 192.168.99.100:5000/hello-world

The above IP to replace the real virtual machine IP, after execution, the native image file should be able to see this images, see:

Note: The original image Hello-world with the image after the tag has the same image ID, indicating that the two images are the same, but the tag is different.

4.3 uploading to a private warehouse

Docker Push 192.168.99.100:5000/hello-world

If it goes well, you should be able to upload it soon:

?  ~  Docker Push 192.168.99.100:5000/hello-worldthe push refers to a repository [192.168.99.100:5000/hello-world] (len : 1) Sending image listpushing repository 192.168.99.100:5000/hello-world (1 tags) 3f12c794407e:image successfully Pushed975b84d108f1:image successfully pushedpushing tag for Rev. [975b84d108f1] on {http://192.168.99.100:5000/v1/ Repositories/hello-world/tags/latest}

can be accessed directly in the browser: Http://192.168.99.100:5000/v1/search, if you can see

{    "Num_results":? 1,    "query": "",    "results": [        {            "description": "",            "name": "library/ Hello-world "        }    ]}

Description Upload Successful

4.4 Download from a private repository

Because this machine already has the mirror of the Hello-world, in order to facilitate verification, first remove it:

Docker rmi-f Hello-world 192.168.99.100:5000/hello-world# or #docker rmi-f 975b84d108f1 #即: Image ID of Hello-world

Then download:

Docker Pull 192.168.99.100:5000/hello-world

Intranet environment, you should be able to download the complete soon:

?  ~  Docker Pull 192.168.99.100:5000/hello-worldusing default tag:latestpulling repository 192.168.99.100:5000/ Hello-world975b84d108f1:download complete3f12c794407e:download completestatus:downloaded Newer image for 192.168.99.100:5000/hello-world:latest192.168.99.100:5000/hello-world:this image is pulled from a legacy registry.  
Important:this registry version is not being supported in the future versions of Docker.

Note: If the private warehouse is to be placed on the public network, it is recommended to set the SSL certificate according to the official recommendation, and enforce the HTTPS protocol, otherwise there will be a security risk.

Reference article:
1. Docker Private Registry Installation Guide under centos6.x
2. Building a private Docker warehouse server
3. Use private Docker registry in Os-x
4. Deploying a Registry Server
5. Allow insecure registry on host provisioned with Docker-machine
6. Adding Trusted root certificates to the server
7. How to Set up a Private Docker Registry on Ubuntu 14.04

Docker Learning (8) building a private warehouse on a Mac machine

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.