Docker Community Forums

Share and learn in the Docker community.

Enable Remote API on Docker hosts in Ubuntu 14

docker

(Souvikbhattacharyas) #1
    0
    down vote

    favorite

I am running ‘Docker version 1.10.3, build 20f81dd’ on Ubuntu 14.04.
Now my requirement is to create/delete/manage new container from the
REST API (HTTP) from outside world. So, for this how could I enable
Docker to run on a port.

It will be helpful if I get details step as in net I tried few but didn’t work.


(Mkwalter) #2

There are some big security concerns that you’ll need to consider, but are not impossible to deal with. On a Ubuntu 14.04 I found numerous references, but only one that actually worked for my configuration.

sudo vi /etc/init/docker.conf

Look for the following lines.

modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)

DOCKER=/usr/bin/$UPSTART_JOB
DOCKER_OPTS=

Update the to…
DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock"
This will allow you to access the remote api via rest call directly from the box. If you want to open things up some more read up on the authentication methods that are available and then change the tcp://ADDRESS accordingly. Don’t forget to put in the unix:///var/run/docker.sock or you will not be able to access docker via the command line.

On later versions of Ubuntu things change a bit from what I’ve seen, but for 14.04 this worked for me.