Build a private Docker database on Centos7
Master: 192.168.1.14
Linux environment
Uname-
Linux master.localhost.com 3.10.0-514.10.2.el7.x86 _ 64 #1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
1. Install docker
Yum install libdevmapper *-y
Yum install docker-y
2. Start docker
Systemctl start docker. service
Systemctc enable docker
3. Set the docker image source accelerator
Curl-sSLhttps: // get. daocloud. io/daotools/set_0000.sh | sh-shttp: // ef017c13. m. daocloud. io
Note: The/etc/docker/daemon. json file is generated for the first time, and the {"registry-mirrors": ["http://48b042ae.m.daocloud.io"]} configuration parameters are written.
Cat/etc/docker/daemon. json
{"Registry-mirrors": ["http://ef017c13.m.daocloud.io"],
"Live-restore": true
}
Download a registry Image
Docker pull registry
4. Start the registry container
Docker run-d-p 5000: 5000-v/opt/data/registry:/tmp/registry
5. Configure the local deamon. json file and add the following parameters:
"Insecure-registries": ["192.168.1.14: 5000"] # This parameter solves the problem of http: server gave HTTP response to HTTPS client.
Cat/etc/docker/daemon. json
{"Registry-mirrors": ["http://ef017c13.m.daocloud.io"],
"Insecure-registries": ["192.168.1.14: 5000"],
"Live-restore": true
}
6. pull test images from the official website
Docker pull redis
7. Tag The test image
Docker tag redis 192.168.1.14: 5000/localredis: 01 # note that the database name cannot contain uppercase letters
8. upload to the local repository
Docker push 192.168.1.14: 5000/localredis: 01
9. delete a local image
Docker rmi 192.168.1.14: 5000/localredis: 01
10. Access through http api
Curl 192.168.1.14: 5000/v2/_ catalog
{"Repositories": ["localredis"]}
Curl 192.168.1.14: 5000/v2/localredis/tags/list
{"Name": "localredis", "tags": ["01"]}
11. Pull the local repository image (for other nodes, configure/etc/docker/daemon. json according to 5)
Docker pull 192.168.1.14: 5000/localredis: 01
12. Verify the download:
Docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
192.168.1.14: 5000/localredis latest 83d6014ac5c8 Less than a second ago 183.6 MB
192.168.1.14: 5000/localredis 01 83d6014ac5c8 Less than a second ago 183.6 MB