0

Docker documentation is pretty good at describing what you can do from the command line.

It also gives a pretty comprehensive description of the commands associated with the remote API.

It does not, however, appear to give sufficient context for using the remote API to do things that one would do using the command line.

An example of what I am talking about: suppose you want to do a command like:

docker run --rm=true -i -t -v /home/user/resources:/files -p 8080:8080 --name SomeService myImage_v3 

using the Remote API. There is a container "run" command in the Remote API:

POST /containers/(id or name)/start

And this command refers back to the create container command for the rather long list of JSON strings that you would need to add in order to do the actual start.

The problem here is: first, just calling this command doesn't work. Apparently there is more that you have to do (I am guessing you have to do a create, then a start). Second, it is unclear which JSON strings you need to use in order to do what I showed in the command line (like setting ports, mapping to the external directory, etc). Not only do the JSON strings provided in the remote API documentation not line up with the command line parameters (at least, not in any way that is obvious!), but it is unclear which JSON strings are required for the create (assuming that we have to do a create, which isn't established yet!) and which are required for the start.

This is just related to starting a container. Suppose you want to stop and destroy a container, as in:

docker stop SomeService
docker rm SomeService

Granted, there appear to be one- to- one commands for doing this in the remote API:

POST /containers/(id or name)/stop
POST /containers/(id or name)/kill

But it seems that the IDs you can pass them do not correspond to the IDs shown when you list containers or images.

Is there somewhere I can go to gather information on how to set up and use remote API commands that relates these commands and their JSON parameters to the commands and parameters in the command line?

Failing that, can someone please tell me how to do the start that I showed in my illustration using the remote API???

In any event: is there someone working on docker development I can bring these documentation issues to? It is, I believe, a big "hole" in their documentation.

Someone please advise...

Factor Three
  • 2,094
  • 5
  • 35
  • 51

1 Answers1

0

docker run is a combination of docker create, followed by docker start, so https://docs.docker.com/engine/reference/api/docker_remote_api_v1.22/#create-a-container, followed by https://docs.docker.com/engine/reference/api/docker_remote_api_v1.22/#start-a-container

If you're running "interactively", you may need to attach to the container after that; https://docs.docker.com/engine/reference/api/docker_remote_api_v1.22/#attach-to-a-container

thaJeztah
  • 27,738
  • 9
  • 73
  • 92
  • 1
    Okay: so I was right about needing to do a create and a run. What about the other parameters? Prior to asking this question (I always research before asking a question here) I had studied the pages you linked to ad nauseam, and still cannot relate the port mappings or the directory mappings that I mentioned in my example. For example: how do you specify a run with -t -v /home/user/resources:/files using the remote API??? – Factor Three Apr 01 '16 at 18:52