MAC Environment deploys Docker private warehouse

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

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

1 docker-machine ip default

Note: If Docker-machine does not start, executing docker-machine start will automatically start a default virtual machine.

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:

12 docker-machine sshdefaultsudo vi/var/lib/boot2docker/profile

At the end of the profile, add:

1 EXTRA_ARGS="--insecure-registry 192.168.99.100:5000"

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

1 docker-machine restart default

Third, create a container

123456 dao pull registry  // 也可以在其他地方下载docker run -d -p 5000:5000 --restart=always -h registry \ --name registry \ -v /Users/edward/data/registry:/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 httpd from the Daocloud.io

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

1 dao pull httpd

4.2 Label Hello-world as a mirror

1 docker tag httpd localhost:5000/httpd

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 httpd 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

1 docker push localhost:5000/httpd

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

1234567 ?  ~  Docker push localhost:5000 /httpd the push refers to a repository [localhost:5000 /httpd "(len:1) sending image list pushing repository localhost:5000 /httpd   (1 tags) 3f12c794407e:image successfully pushed 975b84d108f1:image successfully pushed pushing tag  for  rev [975b84d108f1] on {http: // localhost:5000 /v1/repositories/ Hello-world/tags/latest }

4.4 Downloading from a private repository

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

123 docker rmi -f httpd localhost:5000/httpd#或#docker rmi -f 975b84d108f1 #即:httpd的IMAGE ID

Then download:

1 docker pull localhost:5000/httpd

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

1234567 ?  ~  docker pull localhost:5000/httpdUsing defaulttag: latestPulling repository localhost:5000/httpd975b84d108f1: Download complete3f12c794407e: Download completeStatus: Downloaded newer image forlocalhost:5000/httpd:latestlocalhost:5000/httpd: this image was pulled from a legacy registry.  <br>Important: This registry version will not be supported infuture 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.

5 Verification:

Docker run-d-P 80:80 localhost:5000/httpd

Ok!

MAC Environment deploys Docker private warehouse

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.