Author |
Zqh |
Date |
2016-5-11 |
Introduction
The Docker warehouse actually provides two functions, one is image management and the other is authentication. The former is mainly implemented by the Docker-registry project, which uploads the download via the HTTP service, which can be managed by the Docker-index (closed source) project or by using an off-the-shelf authentication scheme (such as Nginx) for HTTP request management. Environment
Physical machine
Room OpenStack Server
Host virtual Machine network created in Ubuntu Vivid 15.04 image can be connected to the public DNS 10.68.7.142 on the DNSMASQ permissions have root authority or can execute sudo basic structure
The front end uses the Nginx HTTPS protocol for Basic authentication,
and Nginx proxies the 5000 port of Docker registry using the HTTP protocol.
Installing DockerUpdate system
>>> apt-get update && apt-get upgrade-y
>>> reboot
Install Docker Check Curl Package
>>> which Curl
Install the Curl package (this step is already installed)
>>> Apt-get Install Curl
Installing Docker
>>> Curl-ssl https://get.docker.com/| Sh
Note
The https://get.docker.com/content is an installation script, and if it fails, try several times. Test Docker
>>> Docker version #查看版本 client:version:1.9.1 API version:1.21 Go version:go1.4.2 Git commit:a34a 1d5 Built:fri Nov 13:16:54 UTC os/arch:linux/amd64 server:version:1.9.1 API version:1.21 Go version:go1.4.2 Git commit:a34a1d5 built:fri Nov 13:16:54 UTC os/arch:linux/amd64
>>> Docker pull Hello-world #下载镜像测试
Using The default tag:latest
latest:pulling from library/hello-world< C2/>79112a2b2613:pull Complete
4c4abd6d4278:pull complete
digest:sha256 : 4f32210e234b4ad5cac92efacc0a3d602b02476c754f13d517e1ada048e5a8ba
status:downloaded Newer image for Hello-world:latest
Start the Docker Registry serviceDownload Registry Image
>>> Docker pull Registry:2
2:pulling from Library/registry
3059b4820522:pull
complete Ff978d850939:pull Complete
5a85aa5e7c2b:pull complete
8c597b986e48:pull complete
ebf4ce6dfdd0:pull Complete
c45dd354ad24:pull complete
bfc3f550ff55:pull complete
279b06747fae:pull
complete 06552075e36c:pull Complete
Digest:sha256:f8cd74689f55009ad08359688c61054099cc28c90ecc7eaceb83ada0bb69ca75
status:downloaded newer image for Registry:2
Start Docker Registry
>>> Docker run-idt-v/opt/registry:/var/lib/registry-p 5000:5000--restart=always--name Registry Egistry:2 E 60079ce80f9170c46cc1df722e2ef47eeb0395da7123d693c54a82ecd5b1253
I |
Maintain Sdtin Open state |
D: |
Enable the container to run in daemon mode and print the container ID |
T: |
Assigning a TTY (virtual terminal equipment) |
V: |
Bindings mount a path within a container to the host path |
P: |
Map a container's port to the host port |
Restart |
Restart policy when the container exits |
Name |
Name a container |
View the Docker registry process
>>> Docker PS
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
E60079ce80f9 registry:2 "/bin/registry serve" seconds ago up, Seconds 0.0.0.0:5000->5000/tcp Registry
Verify availability hit Tag
>>> Docker tag Hello-world 127.0.0.1:5000/hello-world #给hello-world Mirror Tag
View Local Mirrors
>>> Docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
Registry 2 06552075e36c 6 days ago 171.2 MB
hello-world latest 4c4abd6d4278 2 weeks ago 967 b
127.0.0.1:5000/hello-world latest 4c4abd6d4278 2 weeks ago 967 B
Push Mirroring to private warehouse
>>> Docker push 127.0.0.1:5000/hello-world The
push refers to a repository [127.0.0.1:5000/hello-world] ( Len:1)
4c4abd6d4278:pushed
79112a2b2613:pushed
latest:digest:sha256 : 986c84e32ef73f64fb974588427dec5ff6ed699a8ac59c2414a2300c0d12528a size:2740
View Host Mapping Directory
>>> Ll/opt/registry