How can I recreate the "docker run" using the remote API?
That the remote API calls look like equivalent, say
$ docker run -d our-image
Here's a high level view of what is docker run
doing here and that's a related question .
I tried to solve the problem ContainerConfig
:
curl -X GET 'http://0.0.0.0:2375/images/our-image/json'
For this call:
curl -X POST -H "Content-Type: application/json" -d $CONTAINER_CONFIG 'http://0.0.0.0:2375/containers/create'
And then execute docker run our-image
and compare the output for both respective containers:
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
.
If you read it right, you want to collect detailed information about the parameters passed from the Docker client to the Docker daemon. If so, try 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 delete all client requests as JSON objects.