[Feature Request] REST(ish) API #45

Closed
nathanleclaire opened this Issue Dec 8, 2014 · 1 comment

Comments

Projects
None yet
2 participants
@nathanleclaire
Contributor

nathanleclaire commented Dec 8, 2014

docker machine is evolving towards becoming a useful tool for programmers and systems administrators. It is likely that a demand for:

  1. higher-order functionality such as coordinating the complex interactions and topologies of an Amazon VPC
  2. ways to automate docker machine actions via programming language of choice without shelling out

will emerge in the future as the base gets more stable and robust. I would propose that machine should allow the ability to run in a server mode which accepts API requests (or, we provide some way of wrapping machine which does). It would look something like:

To start server:

$ machine -d -p 7000 
Listening for machine requests on 127.0.0.1:7000....

[in a separate window]

$ curl --silent \
    -X POST \
    -H 'Content-Type: application/json' \
    http://localhost:7000/create \
    -d '{"Driver": "ec2", "AwsAccessKeyId": "blah", "AwsSecretKey": "foo", "HostName": "my-amazon"}'
{
   "HostName":"my-amazon",
   "Status":"Starting"
}

API responds rapidly to request for creating machine and queues action in background. Then user is freed up to do more stuff e.g. check status.

$ curl --silent \
    -X GET \
    http://localhost:7000/ls
[
   {
      "Name":"default",
      "Active":true,
      "Driver":"",
      "State":"",
      "Url":"unix:///var/run/docker.sock"
   },
   {
      "Name":"my-amazon",
      "Active":false,
      "Driver":"ec2",
      "State":"starting",
      "Url":"tcp://50.116.43.32:2376"
   }
]

It allows the possibility of long-running concurrent actions that aren't possible with the current (non-backgrounded) implementation as well- e.g. create a host on Digital Ocean, Rackspace, and Azure concurrently. Right now users would have to "bring their own concurrency" using & or some other solution.

@bfirsh

This comment has been minimized.

Show comment
Hide comment
@bfirsh

bfirsh Jan 29, 2015

Contributor

Thanks for this Nathan! I have added our intentions to move to a client/server model to the roadmap:

https://github.com/docker/machine/blob/master/ROADMAP.md

Contributor

bfirsh commented Jan 29, 2015

Thanks for this Nathan! I have added our intentions to move to a client/server model to the roadmap:

https://github.com/docker/machine/blob/master/ROADMAP.md

@bfirsh bfirsh closed this Jan 29, 2015

tomeon pushed a commit to tomeon/machine that referenced this issue May 9, 2018

Merge pull request #45 from roylee17/build-kernel-in-parallel
Facilitate '-j' when building kernel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment