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访问的配置方法的更多相关文章

  1. docker 远程rest api 访问配置

    Docker RestApi 的配置及使用 Centos Docker1.12 远程Rest api访问的配置方法 http restapiv1.24 docker sdk for python

  2. 网站开发进阶(一)Tomcat域名或IP地址访问方式配置方法

    Tomcat域名或IP地址访问方式配置方法 1.配置www.***.com域名方式访问 在Tomcat下面配置域名(如:www.***.com)的时候,同时又不希望客户通过我们网站的IP或者域名访问到 ...

  3. Linux远程登录ssh免密码配置方法(仅供参考)

    这篇文章主要介绍了linux远程登录ssh免密码配置方法,需要的朋友可以参考下(http://www.0834-3659999.com) 一.情景 公司刚上几台Linux,现在要把主机之间都能远程ss ...

  4. Vue项目无法使用局域网IP直接访问的配置方法

    一般使用 vue-cli 下来的项目是可以直接访问局域网 IP 打开的,比如 192.168.1.11:8080 .但是最近公司的一个项目只可以通过 localhost 访问. 需要配置一下,才可直接 ...

  5. Windows_Server_2008远程桌面多用户登陆的配置方法

    开启远程桌面后,Windows Vista(或Windows 2008)下默认只支持一个administrator用户登陆,一个登录后另一个就被踢掉了,下面提供允许同一个用户名同时多个用户登录的配置方 ...

  6. 配置基于centos下的远程Jupyter Notebook访问

    最近在学习一些服务器上的操作,学着熟悉Liunx系统,记录下自己踩过的坑吧 1.开机后更新系统: yum -y upgrade yum - y update 2.查看已安装的应用 yum list 3 ...

  7. centos linux服务器apache+mysql环境访问慢优化方法

    查找软件安装目录:find / -name 软件名称 一.优化apache配置增加MaxClients的值 默认情况下,2.0及以上apache版本MaxClients的值为256,对于中大型应用访问 ...

  8. Linux中允许远程用户登录访问mysql的方法

    需要手动增加可以远程访问数据库的用户. 方法一.本地登入mysql,更改 "mysql" 数据库里的 "user" 表里的 "host" 项 ...

  9. 允许远程用户登录访问mysql的方法

    需要手动增加可以远程访问数据库的用户. 方法一.本地登入mysql,更改 "mysql" 数据库里的 "user" 表里的 "host" 项 ...

随机推荐

  1. 除去Scala的糖衣(13) -- Default Parameter Value

    欢迎关注我的新博客地址:http://cuipengfei.me/ 好久没有写博客了,上一次更新竟然是一月份. 说工作忙都是借口,咋有空看美剧呢. 这半年荒废掉博客说到底就是懒,惯性的懒惰.写博客这事 ...

  2. 为什么选择使用Spring Cloud而放弃了Dubbo

    为什么选择使用Spring Cloud而放弃了Dubbo 可能大家会问,为什么选择了使用Dubbo之后,而又选择全面使用Spring Cloud呢?其中有几个原因: 1)从两个公司的背景来谈:Dubb ...

  3. PyQt的Layout的比例化分块。

    一. QGridLayout: // 列比 第0列与第1列之比为 1:2 layout2p1 -> setColumnStretch(0, 1); layout2p1 -> setColu ...

  4. git把任意代码提交到已存在的github库中

    git init git add . git remote add origin 远程urlgit branch --set-upstream-to=origin/mastergit pull --a ...

  5. 进制A~Z,全字母26进制转化

    public String to26( int x ) { StringBuffer sBuffer = new StringBuffer(); int cur; x++; while( x > ...

  6. shell命令技巧——文本去重并保持原有顺序

    简单来说,这个技巧相应的是例如以下一种场景 假设有文本例如以下 cccc aaaa bbbb dddd bbbb cccc aaaa 如今须要对它进行去重处理.这个非常easy,sort -u就能够搞 ...

  7. Docker 如何把镜像上传到docker hub

    1 首先你得准备一个hub 的帐号, 去 https://hub.docker.com 注册吧! 2 在hub那里新建一个仓库, 这个就类似于github那边的..create ---> cre ...

  8. WPF进阶之接口(1):IValueConverter,IMultiValueConverter

    看一个例子,FontFamily="Trebuchet MS, GlobalSansSerif.CompositeFont" .这样一条简单的语句,熟悉WPF的人在xaml中可能经 ...

  9. git与sourceTree

    Window:http://my.oschina.net/lunqi/blog/500881?fromerr=bzaPk1Lx MAC:http://www.ithao123.cn/content-8 ...

  10. c#基础 第三讲

    Random r = new Random();                 string x, y;             while (true)             {         ...