Objective
This document records how Docker opens API remote interface settings, the version of Docker is updated too quickly, and the settings may differ between different versions, this article is for docker13.1
1. See where the configuration files are located
2, edit the configuration file contents, receive all IP requests
Vim /lib/systemd/system/docker.service execstart=/usr/bin/dockerd-h Unix://var/run/ Docker.sock-h tcp://0.0.0.0:5678
3. Reload the configuration file and restart the Docker daemon
sudo systemctl daemon-reload sudo systemctl restart Docker
4. Testing
[Email protected] docker]# docker-h localhost:5678versionclient:version:1.13.1API Version:1.26Go version:go1.7.5Git commit:092cba3 built:wed Feb8 .: -: - .OS/arch:linux/amd64server:version:1.13.1API Version:1.26(Minimum version1.12) Go version:go1.7.5Git commit:092cba3 built:wed Feb8 .: -: - .OS/arch:linux/AMD64 Experimental:false[[email protected] docker]# Curl-v-x GET localhost:5678/_ping* About-to-connect () to localhost port5678(#0)* Trying::1...* Connected to localhost (::1) port5678(#0)> GET/_ping http/1.1> user-agent:curl/7.29.0> Host:localhost:5678> Accept: */*> < http/1.1 ok< api-version:1.26< docker-experimental:false< server:docker/1.13.1 (Linux) < D ate:wed, 08:58:12 gmt< content-length:2< content-type:text/plain; charset=utf-8< * Connection #0 to host localhost-left intactok[[email protected] docker]# systemctl show--property=fra Gmentpath Docker Fragmentpath=/usr/lib/systemd/system/docker.service
Indicates that the Docker remote API opened successfully
Docker Open API Remote interface settings