Recently requires the use of docker api. Simply record it
First, the installation configuration
Test machine: ubuntu16.04
Profile path query
systemctl show --property=FragmentPath docker
Profiles
sudo vim /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375
Note: 0.0.0.0 indicates that all ip can call the api, pay attention to the production environment changed to specify ip
Restart docker
sudo systemctl daemon-reload
sudo systemctl restart docker
Api test interfaces
curl http://localhost:2375/version
It returns json data.
Second, the common docker API Interface
Get the current container information: http: // localhost: 2375 / containers / json
Vessel monitoring information: HTTP: // localhost: 2375 / Containers / containers id / json
Export Mirror: HTTP: // localhost: 2375 / Containers / containers id / export
Mirror obtain information on: HTTP: // localhost: 2375 / ImagesRF Royalty Free / json
See more: http://docs.docker-cn.com/engine/api/v1.30/#
Three, docker configuration Ali cloud acceleration
Log Ali cloud into the mirror container services
In a mirror image of your accelerator will speed up the page address
1. Install / Upgrade Docker clients
recommend installing 1.10.0 or later Docker client, refer to the documentation docker-ce
2. Configure mirroring accelerator
for Docker client version greater than 1.10.0 users
You can use accelerator /etc/docker/daemon.json by modifying the daemon configuration file
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker