Enable Docker API for remote connection




1. Tried to edit DOCKER_OPTS and add this line
DOCKER_OPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'in the /etc/init/docker.conf file. and also add this option on the existing "script" part and on the "post script" part.
Did not work - 4243 was not open when I check with # netstat - ntlp

2. Tried to edit and add DOCKER_OPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'
on the /etc/default/docker - file and restart Docker daemon.
Even this did not work.

This is only for UBUNTU
Finally this solution worked:
Edited the docker.service
root@docker:~# vi /lib/systemd/system/docker.service


# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:4243
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576

root@docker:~# systemctl daemon-reload
Warning: docker.service changed on disk. Run 'systemctl daemon-reload' to reload units.
root@docker:~# systemctl daemon-reload

root@docker:~# systemctl restart docker

root@docker:~# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1325/sshd
tcp6       0      0 :::8080                 :::*                    LISTEN      13926/java
tcp6       0      0 :::4243                 :::*                    LISTEN      26921/dockerd
tcp6       0      0 :::22                   :::*                    LISTEN      1325/sshd
root@docker:~# telnet localhost:4243
telnet: could not resolve localhost:4243/telnet: Name or service not known
root@docker:~# telnet localhost 4243
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
^C^C^C^C
Connection closed by foreign host.
root@docker:~#

No comments:

Installing Ingress Controller - Kubernetes

Installing the Ingress Controller Prerequisites Make sure you have access to the Ingress controller image: For NGINX Ingress controll...