Skip to content
Docker Remote API client for Erlang
Erlang Makefile
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.


erldocker is an Erlang application that implements Docker Remote API v1.4.

Public modules are: docker, docker_container and docker_image.

Setting up

To get started, add erldocker app to your release applications list. If you don't use releases, check out the Makefile.


Check out run/sys.config. By default, docker listens on the unix socket serving HTTP. Since Erlang doesn't have something like gen_unix by default, I'm using erldocker_unixbridge that spawns socat to bridge AF_UNIX to AF_INET.

    {erldocker, [
            {unixbridge_port, 32133},
            {docker_http, <<"http://localhost:32133">>}

If your docker is configured to listen on a TCP port, you may use the following configuration:

    {erldocker, [
            {docker_http, <<"http://localhost:4243">>}

Erlang APIs

The APIs are pretty straightforward in general. Please note that the library is under heavy development and some of the APIs (namely the ones that use POST bodies) are not very nice as of right now. This will change without further notice.

Check out the examples:

> docker_container:containers().
      {'Command',<<"/bin/bash -c while true; do sleep 1; date; done">>},
      {'Status',<<"Up About an hour">>},
      {'Command',<<"/bin/bash -c while true; do sleep 1; date; done">>},
      {'Status',<<"Up About an hour">>},

> docker_container:attach_stream("687264242").

> flush().
Shell got {<0.167.0>,{data,<<"Wed Sep  4 08:52:18 UTC 2013\n">>}}
Shell got {<0.167.0>,{data,<<"Wed Sep  4 08:52:19 UTC 2013\n">>}}
Shell got {<0.167.0>,{data,<<"Wed Sep  4 08:52:20 UTC 2013\n">>}}

> exit(pid(0,167,0), kill).
** exception exit: killed

> docker_container:kill("687264242").

> {ok, Info} = docker_container:container("687264242"),
  {_, Image} = lists:keyfind('Image', 1, Info).

> docker_image:image(Image).
You can’t perform that action at this time.