{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/19746","repository_url":"https://api.github.com/repos/docker/docker","labels_url":"https://api.github.com/repos/docker/docker/issues/19746/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/19746/comments","events_url":"https://api.github.com/repos/docker/docker/issues/19746/events","html_url":"https://github.com/docker/docker/pull/19746","id":128941665,"number":19746,"title":"Add support for running a command in a container","user":{"login":"duglin","id":1944671,"avatar_url":"https://avatars.githubusercontent.com/u/1944671?v=3","gravatar_id":"","url":"https://api.github.com/users/duglin","html_url":"https://github.com/duglin","followers_url":"https://api.github.com/users/duglin/followers","following_url":"https://api.github.com/users/duglin/following{/other_user}","gists_url":"https://api.github.com/users/duglin/gists{/gist_id}","starred_url":"https://api.github.com/users/duglin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duglin/subscriptions","organizations_url":"https://api.github.com/users/duglin/orgs","repos_url":"https://api.github.com/users/duglin/repos","events_url":"https://api.github.com/users/duglin/events{/privacy}","received_events_url":"https://api.github.com/users/duglin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels/status/1-design-review","name":"status/1-design-review","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":25,"created_at":"2016-01-26T21:03:33Z","updated_at":"2016-02-15T17:31:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/19746","html_url":"https://github.com/docker/docker/pull/19746","diff_url":"https://github.com/docker/docker/pull/19746.diff","patch_url":"https://github.com/docker/docker/pull/19746.patch"},"body":"This allows for the `docker start` command to take an optional `--cmd` (`-c`) flag to specify the cmd to use instead of the default one from cmd/entrypoint.  Note, this will require you to use `docker create` to first create the container.  The cmd is a \"one time\" command - meaning it does not persist in the container's config or any image. So doing a `docker inspect` on the container before, during or after the `docker start --cmd ...` will not show this override cmd - the CMD/ENTRYPOINT will remain unchanged, and doing a vanilla `docker start <id>` will use CMD/ENTRYPOINT as expected.\r\n\r\nWhen thinking about moving the builder to the client we already have most of the Dockerfile actions already available - in particular `docker cp`. What's nice about this is that you can copy files to/from a container w/o being forces to create a new image each time.  I think we need the same ability for the `RUN` command.  This PR will allow people to run a command in a container w/o being forced to create a new image each time.  One big advantage of this is that it will enable clients to support the notion of squashing layers, which is one of the more popular requested features of `docker build`.\r\n\r\nRight now this only supports the string version of the cmd, not the json array format you can use on `RUN`. If we really want to support that we can add it but for a 1st pass I wanted to keep it simple.\r\n\r\nI also included the docker cli code (from the engine-api repo) and if this PR is ok with people then I'll create a separate PR over there for those bits - but for playing/evaluation I figured it was easier to see it all in one shot.\r\n\r\nSigned-off-by: Doug Davis <dug@us.ibm.com>"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/184318151","html_url":"https://github.com/docker/docker/pull/19746#issuecomment-184318151","issue_url":"https://api.github.com/repos/docker/docker/issues/19746","id":184318151,"user":{"login":"duglin","id":1944671,"avatar_url":"https://avatars.githubusercontent.com/u/1944671?v=3","gravatar_id":"","url":"https://api.github.com/users/duglin","html_url":"https://github.com/duglin","followers_url":"https://api.github.com/users/duglin/followers","following_url":"https://api.github.com/users/duglin/following{/other_user}","gists_url":"https://api.github.com/users/duglin/gists{/gist_id}","starred_url":"https://api.github.com/users/duglin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duglin/subscriptions","organizations_url":"https://api.github.com/users/duglin/orgs","repos_url":"https://api.github.com/users/duglin/repos","events_url":"https://api.github.com/users/duglin/events{/privacy}","received_events_url":"https://api.github.com/users/duglin/received_events","type":"User","site_admin":false},"created_at":"2016-02-15T17:31:34Z","updated_at":"2016-02-15T17:31:34Z","body":"Another usecase: https://github.com/docker/docker/pull/12594#issuecomment-95949029"}}