问题原文
原帖链接 · Lord Loh. · CC BY-SA 3.0
I am using portainer and am unable to manage remote endpoints. I tried using the command line to connect to remote docker nodes, but got a message Cannot connect to the Docker daemon at tcp://<remote_ip>:<port>. Is the docker daemon running?.
Yes, they are running. I have added myself to the docker group and can access docker by SSHing into the nodes. However I cannot access any docker nodes remotely.
I modified /etc/default to add / uncomment DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4 -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock"
I also modified /etc/init.d/docker and /etc/init/docker.conf to include DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock".
I restarted the docker service, logged out and logged in multiple times in the process, but still cannot connect to the remote node. I cannot even connect to the local node by passing the IP.
What did I miss out? What configuration in what file exposes the API over TCP?
user@hostname:~$ docker -H tcp://<REMOTE_IP>:2375 info
Cannot connect to the Docker daemon at tcp://<REMOTE_IP>:2375. Is the docker daemon running?
user@hostname:~$ docker -H tcp://127.0.0.1:2375 info
Cannot connect to the Docker daemon at tcp://127.0.0.1:2375. Is the docker daemon running?
user@hostname:~$ docker -H tcp://<LOCAL_IP>:2375 info
Cannot connect to the Docker daemon at tcp://<LOCAL_IP>:2375. Is the docker daemon running?
user@hostname:~$
Edit:
Running ps aux | grep -i docker returns this -
root 3581 0.1 0.2 596800 41540 ? Ssl 04:17 0:35 /usr/bin/dockerd -H fd://
root 3588 0.0 0.0 653576 14492 ? Ssl 04:17 0:18 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc
已采纳解答
原帖链接 · Lord Loh. · CC BY-SA 4.0
I found a solution thanks to Ivan Krizsan's post.
I had to edit /lib/systemd/system/docker.service on my Ubuntu 16.04.2 LTS system to modify the line
ExecStart=/usr/bin/docker daemon -H fd:// -H tcp://0.0.0.0:
then
sudo systemctl daemon-reload
sudo systemctl restart docker.service
and everything worked :-). The next step is to figure out how to protect the docker daemon form being hijacked.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
