2015年6月22日 星期一

[ 常見問題 ] How to connect to Docker API from another machine?

Source From Here
Question
I'm trying to use the Docker API to connect to docker daemon from another machine. I am able to do this command successfully:
# docker -H=tcp://127.0.0.1:4243 images

But NOT when I use the real IP address:
# docker -H=tcp://192.168.2.123:4243 images
2013/08/04 01:35:53 dial tcp 192.168.2.123:4243: connection refused

Why can't I connect when using a non-local IP?

How-To
Came across a similar issue, one thing I don't see mentioned here is you need to start docker to listen to both the network and a unix socket. All regular docker (command-line) commands on the host assume the socket:
// -H, --host=[] Daemon socket(s) to connect to
// -d, --daemon=false Enable daemon mode
# docker -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock -d &

will start docker listening to any ip address on your host, as well as the typical unix socket.

Supplement
Docker Doc - Docker Command Line - daemon
The Docker daemon is the persistent process that manages containers. Docker uses the same binary for both the daemon and client. To run the daemon you provide the -d flag. To run the daemon with debug output, use docker -d -D...


沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...