I was recently tasked with an issue to allow an application, deployed using
docker-compose, to launch containers
and I did not want to go the docker-in-docker route.
I then figured that using the Docker Remote API to provide this functionality would be sufficient, however, I had difficulties on how to enable the
tcp Socket on distributions running
systemd like Ubuntu 16.04.2, as adding
DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock"
/etc/default/docker does not work.
This is what I pieced together from the Internet:
Edit the file
$ sudo vi /lib/systemd/system/docker.service
Append the following to the
ExecStart=/usr/bin/dockerd -H fd:// line:
-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
$ curl -X GET http://0.0.0.0:2375/_ping
The above should respond with
Hope someone out there finds this helpful.
NOTE: This provides un-encrypted and un-authenticated direct access to the daemon.