{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/15182","labels_url":"https://api.github.com/repos/docker/docker/issues/15182/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/15182/comments","events_url":"https://api.github.com/repos/docker/docker/issues/15182/events","html_url":"https://github.com/docker/docker/pull/15182","id":98284612,"number":15182,"title":"Support for passing build-time variables in build context","user":{"login":"mapuri","id":9538438,"avatar_url":"https://avatars.githubusercontent.com/u/9538438?v=3","gravatar_id":"","url":"https://api.github.com/users/mapuri","html_url":"https://github.com/mapuri","followers_url":"https://api.github.com/users/mapuri/followers","following_url":"https://api.github.com/users/mapuri/following{/other_user}","gists_url":"https://api.github.com/users/mapuri/gists{/gist_id}","starred_url":"https://api.github.com/users/mapuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapuri/subscriptions","organizations_url":"https://api.github.com/users/mapuri/orgs","repos_url":"https://api.github.com/users/mapuri/repos","events_url":"https://api.github.com/users/mapuri/events{/privacy}","received_events_url":"https://api.github.com/users/mapuri/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels/group/distribution","name":"group/distribution","color":"F6FBFF"},{"url":"https://api.github.com/repos/docker/docker/labels/status/4-merge","name":"status/4-merge","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":59,"created_at":"2015-07-30T23:19:13Z","updated_at":"2015-08-27T18:27:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/15182","html_url":"https://github.com/docker/docker/pull/15182","diff_url":"https://github.com/docker/docker/pull/15182.diff","patch_url":"https://github.com/docker/docker/pull/15182.patch"},"body":"This PR builds on top of the changes proposed in #9176 and addresses the additional requirements for build-time variables as tracked by #14634 \r\n\r\nBelow is a quick usage and overview of the feature. For more context on the use-cases this enables, please refer the discussion in #9176 and #14634 :\r\n\r\n**Usage**:\r\n```\r\ndocker build --build-arg http_proxy=http://my.proxy.url  --build-arg foo=bar <<MARK\r\nFROM busybox\r\nRUN <command that need http_proxy>\r\nARG --description=\"foo's description\" foo\r\nUSER $foo\r\nMARK\r\n```\r\n\r\n**Brief overview**:\r\n- The build-time variables are passed as environment-context for command(s)\r\nrun as part of the RUN primitve. These variables are not persisted in environment of\r\nintermediate and final images when passed as context for RUN. The build environment\r\nis prepended to the intermediate continer's command string for aiding cache lookups.\r\nIt also helps with build traceability. But this also makes the feature less secure from\r\npoint of view of passing build time secrets.\r\n\r\n- The build-time variables also get used to expand the symbols used in certain\r\nDockerfile primitves like ADD, COPY, USER etc, without an explicit prior definiton using a\r\nENV primitive. These variables get persisted in the intermediate and final images\r\nwhenever they are expanded.\r\n\r\n- The build-time variables are only expanded or passed to the RUN primtive if they\r\nare defined in Dockerfile using the ARG primitive or belong to list of built-in variables.\r\nHTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy, FTP_PROXY and NO_PROXY are built-in\r\nvariables that needn't be explicitly defined in Dockerfile to use this feature."},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/135514806","html_url":"https://github.com/docker/docker/pull/15182#issuecomment-135514806","issue_url":"https://api.github.com/repos/docker/docker/issues/15182","id":135514806,"user":{"login":"tiborvass","id":827131,"avatar_url":"https://avatars.githubusercontent.com/u/827131?v=3","gravatar_id":"","url":"https://api.github.com/users/tiborvass","html_url":"https://github.com/tiborvass","followers_url":"https://api.github.com/users/tiborvass/followers","following_url":"https://api.github.com/users/tiborvass/following{/other_user}","gists_url":"https://api.github.com/users/tiborvass/gists{/gist_id}","starred_url":"https://api.github.com/users/tiborvass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tiborvass/subscriptions","organizations_url":"https://api.github.com/users/tiborvass/orgs","repos_url":"https://api.github.com/users/tiborvass/repos","events_url":"https://api.github.com/users/tiborvass/events{/privacy}","received_events_url":"https://api.github.com/users/tiborvass/received_events","type":"User","site_admin":false},"created_at":"2015-08-27T18:27:54Z","updated_at":"2015-08-27T18:27:54Z","body":"As for `--description` it is not needed for this PR to solve the issues it solves. We don't have descriptions for labels either nor for command line params, that's what the README is for. Also in practice, most of those build args should have a pretty straightforward names, implying their description. Again it is not necessary to solve the issues.\r\n\r\nI feel so bad I didn't follow up on this PR earlier :(\r\n\r\nAt least now I said what I had to say, now feel free to decide to merge as-is or not."}}