3

What do the remote API calls look like to do the equivalent of, say

$ docker run -d our-image

There's a high-level view of what docker run is doing here, and this is a related question.

I've tried coping the ContainerConfig portion of:

curl -X GET 'http://0.0.0.0:2375/images/our-image/json'

To this call:

curl -X POST -H "Content-Type: application/json" -d $CONTAINER_CONFIG 'http://0.0.0.0:2375/containers/create'

And then doing a docker run our-image and comparing, for both respective containers created, the output of:

curl -X GET 'http://0.0.0.0:2375/containers/<container-id>/json'

And I notice some fields like HostnamePath, and LogPath which are set in the version launched with docker run.

Community
  • 1
  • 1
jberryman
  • 16,334
  • 5
  • 42
  • 83
  • 2
    Have you studied the source code of [docker-compose](https://github.com/docker/compose) -- This is written in Python and uses the [docker-py](https://pypi.python.org/pypi/docker-py) python library which is a library around the Docket Remote API. – James Mills Apr 21 '15 at 03:43

1 Answers1

3

If I understand you correctly, you want to collect detailed information about the parameters passed from Docker client to Docker daemon. If so, try to use this workaround:

cd /var/run
sudo mv docker.sock docker.sock.orig
sudo socat -v UNIX-LISTEN:/var/run/docker.sock,group=docker,perm=0660,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sock.orig

This command will dump all the client requests as JSON objects.

Vitaly Isaev
  • 5,392
  • 6
  • 45
  • 64