Exposing a HTTP endpoint for Docker


Recent versions of Docker (>= 1.3.0) no longer expose a HTTP endpoint, opting instead the more secure HTTPS protocol. Unfortunately it may not be possible in some environments or with some tools to use HTTPS. The following is a quick workaround to use the socat utility to proxy access to the Docker socket.

My particular use case is the Jenkins Docker Plugin. Since Jenkins is Java-based, SSL issues require messing with the Java Trust Store. The managment of certificates and trust configuration in Java is decidely un-Unixy and not really something I want to get involved in. Luckly there is a Docker container available to solve the problem of the missing HTTP endpoint.

Execute the commands below to pull a copy of the sequenceiq/socat container and run it, opening up TCP port 2375, the original Docker HTTP port. This should allow clients to avoid having to use HTTPS to access Docker.

$ docker pull sequenceiq/socat
$ docker run -d \
      -p 2375:2375 \
      --volume=/var/run/docker.sock:/var/run/docker.sock \
      --name=docker-http \
      sequenceiq/socat

The sequenceiq/socat container is documented more fully in this blog post at the SequenceIQ website.

Related Posts

A Pattern for Unit Testing Completion Blocks in Objective-C

Installing Extra Packages on Boot2docker

Building Debian Packages with Ccache

Using Ccache with Docker