Docker Remote API 配置

默认情况下,Docker只允许通过unix socket通信操作Docker daemon,但有时我们想通过HTTP调用其Rest API,需单独配置启动参数

 

为了使配置永久生效,在Ubuntu环境下修改其配置文件/etc/default/docker,(centos : /etc/sysconfig/docker) 加入DOCKER_OPTS="-H=unix:///var/run/docker.sock -H=0.0.0.0:6732",重启Docker服务,可通过浏览器访问设置主机:端口号(6372)/ Docker API操作Docker

 

  1. # Docker Upstart and SysVinit configuration file  
  2.   
  3. # Customize location of Docker binary (especially for development testing).  
  4. #DOCKER="/usr/local/bin/docker"  
  5.   
  6. # Use DOCKER_OPTS to modify the daemon startup options.  
  7. #DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"  
  8. DOCKER_OPTS="-H=unix:///var/run/docker.sock -H=0.0.0.0:6732"  
  9. # If you need Docker to use an HTTP proxy, it can also be specified here.  
  10. #export http_proxy="http://127.0.0.1:3128/"  
  11.   
  12. # This is also a handy place to tweak where Docker's temporary files go.  
  13. #export TMPDIR="/mnt/bigdrive/docker-tmp"  
 
posted @ 2015-10-26 09:35  飞鸟投林  阅读(651)  评论(0编辑  收藏  举报