{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/27393","repository_url":"https://api.github.com/repos/docker/docker","labels_url":"https://api.github.com/repos/docker/docker/issues/27393/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/27393/comments","events_url":"https://api.github.com/repos/docker/docker/issues/27393/events","html_url":"https://github.com/docker/docker/issues/27393","id":183099266,"number":27393,"title":"Proposal: docker build read Dockerfile from stdin","user":{"login":"dsheets","id":59918,"avatar_url":"https://avatars.githubusercontent.com/u/59918?v=3","gravatar_id":"","url":"https://api.github.com/users/dsheets","html_url":"https://github.com/dsheets","followers_url":"https://api.github.com/users/dsheets/followers","following_url":"https://api.github.com/users/dsheets/following{/other_user}","gists_url":"https://api.github.com/users/dsheets/gists{/gist_id}","starred_url":"https://api.github.com/users/dsheets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsheets/subscriptions","organizations_url":"https://api.github.com/users/dsheets/orgs","repos_url":"https://api.github.com/users/dsheets/repos","events_url":"https://api.github.com/users/dsheets/events{/privacy}","received_events_url":"https://api.github.com/users/dsheets/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels/area/builder","name":"area/builder","color":"fbca04"},{"url":"https://api.github.com/repos/docker/docker/labels/kind/feature","name":"kind/feature","color":"AAB3AB"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-10-14T16:54:20Z","updated_at":"2016-10-18T11:14:45Z","closed_at":null,"body":"I propose that `docker build` accept `-f -` to indicate that the Dockerfile to be used is read from the STDIN of the `docker` client process.\r\n\r\n### Use cases\r\n - Shared engine CI systems can now stack anonymous image builds easily without requiring intermediate directories or tar archives\r\n - Dockerfiles in local directories, tar archives, and git repos can now be overridden\r\n - `docker build` is now a versatile shell scripting command as Dockerfiles can participate in shell pipelines decoupled from file system contexts\r\n\r\n### New capabilities\r\n - Uncooperative remote tar archives and git repos can now have out-of-band Dockerfiles applied to them\r\n - Local directory builds can now have Dockerfiles imported for *just* the build via I/O redirection\r\n\r\n### Design considerations\r\n - A `-` stdin reader interface already exists in the context path argument so any `-f -` implementation will have to accommodate that\r\n - Accepting `-` in place of file paths is a common UNIX idiom to indicate that what would have been read from the path specified should instead be read from stdin; this makes having `docker` participate in UNIX pipelines much easier\r\n - This feature could be abused to avoid Best Practice so all advice regarding application/system design should be maintained and users should be encouraged to place Dockerfiles in repositories and tarballs so builds are straightforward and unambiguous when possible\r\n\r\n### Cases\r\n - `builder.GetContextFromReader` (`builder/context.go`) is used to read a context (or Dockerfile only) from stdin: nothing will change, a file called `-` will still be sourced from the stdin tarball (or still ignored in the case of `Dockerfile` only on stdin)\r\n - `builder.GetContextFromGitURL` (`builder/context.go`) is used to read a context from a git URL and the resultant context will have its `Dockerfile` rewritten and used for the build\r\n - `builder.GetContextFromURL` (`builder/context.go`) is used to read a context from a remote URL and the resultant context will have its `Dockerfile` rewritten and used for the build (or ignored in the case of a `Dockerfile` only context)\r\n - `builder.GetContextFromLocalDir` (`builder/context.go`) is used to read a context from a local directory and the resultant context will have its `Dockerfile` rewritten and used for the build\r\n\r\n### Implementation\r\nI've prototyped this functionality by rewriting the tar stream of the context before the trusted pull rewriting. If there is interest in this functionality, I will clean up my prototype and submit a PR. I welcome your ideas regarding this or similar features. Thanks!"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/254477704","html_url":"https://github.com/docker/docker/issues/27393#issuecomment-254477704","issue_url":"https://api.github.com/repos/docker/docker/issues/27393","id":254477704,"user":{"login":"justincormack","id":482364,"avatar_url":"https://avatars.githubusercontent.com/u/482364?v=3","gravatar_id":"","url":"https://api.github.com/users/justincormack","html_url":"https://github.com/justincormack","followers_url":"https://api.github.com/users/justincormack/followers","following_url":"https://api.github.com/users/justincormack/following{/other_user}","gists_url":"https://api.github.com/users/justincormack/gists{/gist_id}","starred_url":"https://api.github.com/users/justincormack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justincormack/subscriptions","organizations_url":"https://api.github.com/users/justincormack/orgs","repos_url":"https://api.github.com/users/justincormack/repos","events_url":"https://api.github.com/users/justincormack/events{/privacy}","received_events_url":"https://api.github.com/users/justincormack/received_events","type":"User","site_admin":false},"created_at":"2016-10-18T11:14:45Z","updated_at":"2016-10-18T11:14:45Z","body":"I think this is a bit inconsistent, as I believe `-f` always just points to a name in the context, and `-f -` does not make sense like that.\r\n\r\nI think it would be better to allow multiple contexts which are appended so you could do `docker build git://... Dockerfile` which would append the Dockerfile to the git bundle, overwriting any `Dockerfile` in it, and then you could also allow `docker build git:// -` as a file (vs tarball) on `stdin` is assumed to be a file called `Dockerfile`. I have other use cases for multiple appended bundles as a build context as well."}}
{"actor":{"display_login":"justincormack"}}