Home  >  Article  >  Backend Development  >  Introduction to how docker provides API access

Introduction to how docker provides API access

不言
不言forward
2019-03-30 09:58:552518browse

This article brings you an introduction to the method of docker providing API access. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Docker provides api access

Environment centos

vim /etc/docker/daemon.json

Add the following configuration

{
  "hosts": [
    "tcp://0.0.0.0:2375",
    "unix:///var/run/docker.sock"
  ]
}

Add After deamon.json

dockerd command can start docker

At this time, requesting 127.0.0.1:2375 can be accessed normally

Using systemctl cannot start docker

systemctl restart docker
systemctl start docker

Unable to start docker

View the current docker configuration

systemctl cat docker | grep Exec
ExecStart=/usr/bin/dockerd -H fd://
ExecReload=/bin/kill -s HUP $MAINPID

Overwrite the configuration

systemctl edit docker
添加
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd

View the configuration again

systemctl cat docker | grep Exec
ExecStart=/usr/bin/dockerd -H fd://
ExecReload=/bin/kill -s HUP $MAINPID
ExecStart=
ExecStart=/usr/bin/dockerd

You can use the systemctl command to start docker

This article has ended here. For more exciting content, you can pay attention to the dockerr video tutorial column on the PHP Chinese website!

The above is the detailed content of Introduction to how docker provides API access. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete