docker mirror acceleration CentOS7 details
- 2020-05-30 21:18:04
- OfStack
preface
Register your Docker Hub account on the Docker Hub website, and you can download and use all the docker images in the repository. Because of network reasons, domestic developers can not smoothly download the image, often appear download interruption error. The solution is to use the domestic container Hub to speed up the service, essentially changing the higher priority pull server to a domestic site.
Domestic docker mirror acceleration station
Ali cloud
DaoCloud
Spirit finches cloud
System environment
Operating system: CentOS 7
docker version: 1.9.1
DaoCloud acceleration
DaoCloud now provides a 1 key script configuration for registry-mirror, however this will not work for the above environment.
When you execute the help command for docker daemon service, you find that there is no option to use the registry-mirror option. Instead, you use the add-registry option.
The specific commands are as follows:
$ sudo docker daemon -h
Usage: docker daemon [OPTIONS]
Enable daemon mode
--add-registry=[] Registry to query before a public one
--api-cors-header= Set CORS headers in the remote API
-b, --bridge= Attach containers to a network bridge
--bip= Specify network bridge IP
--block-registry=[] Don't contact given registry
--cluster-advertise= Address or interface name to advertise
--cluster-store= Set the cluster store
--cluster-store-opt=map[] Set cluster store options
--confirm-def-push=true Confirm a push to default registry
-D, --debug=false Enable debug mode
--default-gateway= Container default gateway IPv4 address
--default-gateway-v6= Container default gateway IPv6 address
--default-ulimit=[] Set default ulimits for containers
--disable-legacy-registry=false Do not contact legacy registries
--dns=[] DNS server to use
--dns-opt=[] DNS options to use
--dns-search=[] DNS search domains to use
-e, --exec-driver=native Exec driver to use
--exec-opt=[] Set exec driver options
--exec-root=/var/run/docker Root of the Docker execdriver
--fixed-cidr= IPv4 subnet for fixed IPs
--fixed-cidr-v6= IPv6 subnet for fixed IPs
-G, --group=docker Group for the unix socket
-g, --graph=/var/lib/docker Root of the Docker runtime
-H, --host=[] Daemon socket(s) to connect to
--help=false Print usage
--icc=true Enable inter-container communication
--insecure-registry=[] Enable insecure registry communication
--ip=0.0.0.0 Default IP when binding container ports
--ip-forward=true Enable net.ipv4.ip_forward
--ip-masq=true Enable IP masquerading
--iptables=true Enable addition of iptables rules
--ipv6=false Enable IPv6 networking
-l, --log-level=info Set the logging level
--label=[] Set key=value labels to the daemon
--log-driver=json-file Default driver for container logs
--log-opt=map[] Set log driver options
--mtu=0 Set the containers network MTU
-p, --pidfile=/var/run/docker.pid Path to use for daemon PID file
--registry-mirror=[] Preferred Docker registry mirror
-s, --storage-driver= Storage driver to use
--selinux-enabled=false Enable selinux support
--storage-opt=[] Set storage driver options
--tls=false Use TLS; implied by --tlsverify
--tlscacert=~/.docker/ca.pem Trust certs signed only by this CA
--tlscert=~/.docker/cert.pem Path to TLS certificate file
--tlskey=~/.docker/key.pem Path to TLS key file
--tlsverify=false Use TLS and verify the remote
--userland-proxy=true Use userland proxy for loopback traffic
Add the following code to file /etc/sysconfig/docker:
ADD_REGISTRY='-- add-registry [url of your accelerator station]'
Then, restart Docker.
sudo systemctl daemon-reload
sudo service docker restart
Using image acceleration
1. Please login before pulling the image: docker login daocloud.io (please use the user name to login)
2.docker pull [mirror you need]
subsequent
After the use test: when downloading the docker image, there will no longer be a hint of download failure. It is roughly estimated that the download speed will be around 200k/s, which basically meets the use requirements.
Thank you for reading, I hope to help you, thank you for your support of this site!