默认状况下,Docker只容许经过unix socket通讯操做Docker daemon,但有时咱们想经过HTTP调用其Rest API,需单独配置启动参数html
为了使配置永久生效,在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操做Dockerdocker
- # Docker Upstart and SysVinit configuration file
- # Customize location of Docker binary (especially for development testing).
- #DOCKER="/usr/local/bin/docker"
- # Use DOCKER_OPTS to modify the daemon startup options.
- #DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
- DOCKER_OPTS="-H=unix:///var/run/docker.sock -H=0.0.0.0:6732"
- # If you need Docker to use an HTTP proxy, it can also be specified here.
- #export http_proxy="http://127.0.0.1:3128/"
- # This is also a handy place to tweak where Docker's temporary files go.
- #export TMPDIR="/mnt/bigdrive/docker-tmp"