Docker Private Warehouse Recovery example detailed _docker

Source: Internet
Author: User
Tags curl docker run

Docker Private Warehouse Recovery

Prior to the OpenStack platform due to power outages and other effects, resulting in the previous production of registry private warehouse host hung up, fortunately the data is mounted in NFS, and then now try to restart the recovery.

Virtual Machine Install NFS Service

Apt-get install-y Nfs-common

Edit/etc/fstab

Write Remote Mount Address

10.50.8.12:/export/dockerrepo/var/lib/docker/registry NFS Defaults 0 0

And then mount the load:

Mount-a-V

Outputs the following results, indicating that the mount was successful

root@docker-registry:/home/ubuntu# mount-a-V
mount.nfs:timeout set for Thu Mar 13:12:44 2015
mount.nfs:tryi ng text-based Options ' vers=4,addr=10.50.8.12,clientaddr=10.0.0.244 ' Nothing is
mounted

You can use DF to view:

root@docker-registry:/home/ubuntu# DF
filesystem          1k-blocks  Used Available use% mounted on
/dev/vda1           165106028 1780156 156584392  2%/
None                 4    0     4  0%              /sys/fs/cgroup udev 8211996  8211984  1%/dev
tmpfs              1643392   348
1643044 1%/run None                5120    0   5120  0%/run/lock
none              8216952    0  8216952
0%/RUN/SHM None               102400    0  102400  0%/run/user
10.50.8.12:/export/dockerrepo 515931136 683008 489017344  1%/var/lib/docker/registry

Create a new registry

Commands are as follows

# Docker run-d-P 5000:5000-v/var/lib/docker/registry:/tmp/registry Registry

Where-P is the port mapping with the host, and-V indicates that the volume of the host is mounted to the container, and that our NFS is mounted in the container as a storage use for the Docker private warehouse.

To see if a success was created

Use the Curl command to search for the existence of the warehouse file:

root@docker-registry:/var/lib/docker/registry/images# Curl Http://127.0.0.1:5000/v1/search
{"Num_results": 8, ' Query ': ', ' results ': [{' description ': null, ' name ': ' Shipyard/rethinkdb '}, {' description ': null, ' name ': ' shipyard/ Shipyard "}, {" description ": null," name ":" Shipyard/shipyard-cli "}, {" description ": null," name ":" Library/mysql "}, {" Description ": null," name ":" Library/ubuntu "}, {" description ": null," name ":" Library/registry "}, {" description ": null, ' Name ': ' Library/centos '}, {' description ': null, ' name ': ' Tutum/influxdb '}]}

Testing a private Warehouse

Pull the ubuntu:14.04 mirror from the private warehouse.

root@docker-registry:/var/lib/docker/registry/images# Docker pull 127.0.0.1:5000/ubuntu:14.04
Pulling Repository 127.0.0.1:5000/ubuntu
2103b00b3fdf:download complete 
511136ea3c5a:download 
complete F0dde87450ec:download Complete 
76b658ecb564:download complete 
4faa69f72743:download complete 
Status: Downloaded newer image for 127.0.0.1:5000/ubuntu:14.04

You can then view the existing images by Docker images:

root@docker-registry:/var/lib/docker/registry/images# Docker images
REPOSITORY       TAG         IMAGE ID      CREATED       VIRTUAL SIZE
Registry        latest       e33e81d7024c    5 days ago     413.7 MB
127.0.0.1:5000/ubuntu  Latest       2103b00b3fdf    2 weeks ago     192.7 MB
127.0.0.1:5000/ubuntu  14.04        2103b00b3fdf    2 weeks ago     192.7 MB

It takes only more than 10 seconds from the private warehouse to pull the image of Ubuntu's more than 200 m.

Thank you for reading, I hope to help you, thank you for your support for this site!

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.