如何使用docker远程API?

我在ubuntu 14.04上安装了ubuntu 14.04 ,而且工作正常。

etc/default/docker我有这样的configuration:

 # 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" # 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" 

我跑docker run hello-world ,然后在var/run/docker.sock文件没有被写入。

我怎样才能从该文件收听,以使用远程API ?

提前致谢。

如果您看到类似于“ 使用boot2docker在Mac或Windows上运行Docker ”中显示的错误消息,

 $ docker run hello-world 2014/08/11 15:05:55 Post http:///var/run/docker.sock/v1.13/containers/create: dial unix /var/run/docker.sock: no such file or directory 

然后确保你已经正确设置了DOCKER_HOST环境variables。
docker机 ,应该设置:

 docker-machine env dev 

一旦完成,那么一个简单的GET应该工作:

 echo -e "GET /images/json HTTP/1.0\r\n" | nc -U /var/run/docker.sock 

这使用Netcat实用程序 ( nc命令)。