服务器 
首页 > 服务器 > 浏览文章

Centos Docker1.12 远程Rest api访问的配置方法

(编辑:jimmy 日期: 2024/5/9 浏览:3 次 )

Docker默认是没有开启HTTP远程访问的,默认只支持通过unix socket通信操作docker daemon,需要使用HTTP restful接口需要修改配置。

1、修改配置文件,文件位置/lib/systemd/system/docker.service。将原来的ExecStart修改为:

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
#ExecStart=/usr/bin/dockerd
#ExecStart=/usr/bin/dockerd -H 192.168.25.130:2375
ExecStart=/usr/bin/docker daemon --tls=false -H unix:///var/run/docker.sock -H tcp://192.168.25.130:2375
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
[Install]
WantedBy=multi-user.target

2.执行

systemctl daemon-reload
systemctl restart docker.service

注:如果docker命令是无法使用的请在、etc/profile中配置:

export DOCKER_HOST= 'http://192.168.25.128:2375'

是之生效

source /etc/profile

3、官方API说明文档

官方链接:Docker Remote API v1.24

以上所述是小编给大家介绍的Centos Docker1.12 远程Rest api访问,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!

上一篇:linux线程的取消(终止)方法
下一篇:Linux多线程环境下 关于进程线程终止函数总结
一句话新闻
高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网