{"action":"created","comment":{"url":"https://api.github.com/repos/docker/docker/pulls/comments/27527705","id":27527705,"diff_hunk":"@@ -760,6 +762,46 @@ you refer to it on the command line.\n > children) for security reasons, and to ensure repeatable builds on remote\n > Docker hosts. This is also the reason why `ADD ../file` will not work.\n \n+Sometimes building an image will require access to certain environment variables\n+that are specific to the build host like http-proxy; user credentials for\n+pulling intermediate files etc. Most likely these variables can't be persisted\n+in the built image for portatbility or security reasons i.e. it's not desirable\n+to use the 'ENV' primitive of the Dockerfile.\n+\n+    $ docker build --build-env HTTP_PROXY=http://10.20.30.2:1234 .\n+\n+This will allow passing the built-time environment variables, that can be\n+accessed like regular environment variables in the 'RUN' primitive of the\n+Dockerfile, without persisting them in the intermediate or final images.\n+\n+> **Note:** environment variables defined using 'ENV' primitive of Dockerfile\n+> will override the build-time environment variables.\n+\n+> **Note:** When desirable, variables passed from command-line can be persisted\n+> in the final image by using ENV primitive and build-time environment variables\n+> as shown below.\n+\n+    $ docker build --build-env CONT_IMG_VER=v1.0.1 - <<MARK\n+    -> FROM ubuntu\n+    -> ENV CONT_IMG_VER {$foo:-notSet}","path":"docs/sources/reference/commandline/cli.md","position":34,"original_position":34,"commit_id":"7af13a497e1f4ea0ac77aeb480b56a2bc9aefbcb","original_commit_id":"7af13a497e1f4ea0ac77aeb480b56a2bc9aefbcb","user":{"login":"calavera","id":1050,"avatar_url":"https://avatars.githubusercontent.com/u/1050?v=3","gravatar_id":"","url":"https://api.github.com/users/calavera","html_url":"https://github.com/calavera","followers_url":"https://api.github.com/users/calavera/followers","following_url":"https://api.github.com/users/calavera/following{/other_user}","gists_url":"https://api.github.com/users/calavera/gists{/gist_id}","starred_url":"https://api.github.com/users/calavera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calavera/subscriptions","organizations_url":"https://api.github.com/users/calavera/orgs","repos_url":"https://api.github.com/users/calavera/repos","events_url":"https://api.github.com/users/calavera/events{/privacy}","received_events_url":"https://api.github.com/users/calavera/received_events","type":"User","site_admin":false},"body":"It would be better if this PR didn't depend on #11149 only for documentation purposes. The maintainers will be more eager to merge it :wink: ","created_at":"2015-03-31T22:00:16Z","updated_at":"2015-03-31T22:00:16Z","html_url":"https://github.com/docker/docker/pull/9176#discussion_r27527705","pull_request_url":"https://api.github.com/repos/docker/docker/pulls/9176","_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/comments/27527705"},"html":{"href":"https://github.com/docker/docker/pull/9176#discussion_r27527705"},"pull_request":{"href":"https://api.github.com/repos/docker/docker/pulls/9176"}}},"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/9176","id":24466071,"html_url":"https://github.com/docker/docker/pull/9176","diff_url":"https://github.com/docker/docker/pull/9176.diff","patch_url":"https://github.com/docker/docker/pull/9176.patch","issue_url":"https://api.github.com/repos/docker/docker/issues/9176","number":9176,"state":"open","locked":false,"title":"Proposal: Add support for build-time environment variables to the 'build' API","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},"body":"A build-time environment variable gets used only while processing the 'RUN' primitive of a DockerFile. Such a variable is only accessible during 'RUN' and is 'not' persisted with the intermediate and final docker images, thereby addressing the portability concerns of the images generated with 'build'.\r\n\r\nThis addresses issue #4962","created_at":"2014-11-14T19:55:24Z","updated_at":"2015-03-31T22:00:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fdd80c5728125cef60c798b479869908a0f29e70","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/docker/pulls/9176/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/9176/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/9176/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/7af13a497e1f4ea0ac77aeb480b56a2bc9aefbcb","head":{"label":"mapuri:master","ref":"master","sha":"7af13a497e1f4ea0ac77aeb480b56a2bc9aefbcb","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},"repo":{"id":26605164,"name":"docker","full_name":"mapuri/docker","owner":{"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},"private":false,"html_url":"https://github.com/mapuri/docker","description":"Docker - the open-source application container engine","fork":true,"url":"https://api.github.com/repos/mapuri/docker","forks_url":"https://api.github.com/repos/mapuri/docker/forks","keys_url":"https://api.github.com/repos/mapuri/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapuri/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapuri/docker/teams","hooks_url":"https://api.github.com/repos/mapuri/docker/hooks","issue_events_url":"https://api.github.com/repos/mapuri/docker/issues/events{/number}","events_url":"https://api.github.com/repos/mapuri/docker/events","assignees_url":"https://api.github.com/repos/mapuri/docker/assignees{/user}","branches_url":"https://api.github.com/repos/mapuri/docker/branches{/branch}","tags_url":"https://api.github.com/repos/mapuri/docker/tags","blobs_url":"https://api.github.com/repos/mapuri/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapuri/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapuri/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapuri/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapuri/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/mapuri/docker/languages","stargazers_url":"https://api.github.com/repos/mapuri/docker/stargazers","contributors_url":"https://api.github.com/repos/mapuri/docker/contributors","subscribers_url":"https://api.github.com/repos/mapuri/docker/subscribers","subscription_url":"https://api.github.com/repos/mapuri/docker/subscription","commits_url":"https://api.github.com/repos/mapuri/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapuri/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapuri/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapuri/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapuri/docker/contents/{+path}","compare_url":"https://api.github.com/repos/mapuri/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapuri/docker/merges","archive_url":"https://api.github.com/repos/mapuri/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapuri/docker/downloads","issues_url":"https://api.github.com/repos/mapuri/docker/issues{/number}","pulls_url":"https://api.github.com/repos/mapuri/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/mapuri/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/mapuri/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapuri/docker/labels{/name}","releases_url":"https://api.github.com/repos/mapuri/docker/releases{/id}","created_at":"2014-11-13T19:55:02Z","updated_at":"2015-03-25T21:37:40Z","pushed_at":"2015-03-25T21:37:37Z","git_url":"git://github.com/mapuri/docker.git","ssh_url":"git@github.com:mapuri/docker.git","clone_url":"https://github.com/mapuri/docker.git","svn_url":"https://github.com/mapuri/docker","homepage":"http://www.docker.com","size":46670,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"3d9cbf0e7176e8aa5d4078cd00a400e1dcc5169d","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":7691631,"name":"docker","full_name":"docker/docker","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/docker","description":"Docker - the open-source application container engine","fork":false,"url":"https://api.github.com/repos/docker/docker","forks_url":"https://api.github.com/repos/docker/docker/forks","keys_url":"https://api.github.com/repos/docker/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/docker/teams","hooks_url":"https://api.github.com/repos/docker/docker/hooks","issue_events_url":"https://api.github.com/repos/docker/docker/issues/events{/number}","events_url":"https://api.github.com/repos/docker/docker/events","assignees_url":"https://api.github.com/repos/docker/docker/assignees{/user}","branches_url":"https://api.github.com/repos/docker/docker/branches{/branch}","tags_url":"https://api.github.com/repos/docker/docker/tags","blobs_url":"https://api.github.com/repos/docker/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/docker/languages","stargazers_url":"https://api.github.com/repos/docker/docker/stargazers","contributors_url":"https://api.github.com/repos/docker/docker/contributors","subscribers_url":"https://api.github.com/repos/docker/docker/subscribers","subscription_url":"https://api.github.com/repos/docker/docker/subscription","commits_url":"https://api.github.com/repos/docker/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/docker/contents/{+path}","compare_url":"https://api.github.com/repos/docker/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/docker/merges","archive_url":"https://api.github.com/repos/docker/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/docker/downloads","issues_url":"https://api.github.com/repos/docker/docker/issues{/number}","pulls_url":"https://api.github.com/repos/docker/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/docker/labels{/name}","releases_url":"https://api.github.com/repos/docker/docker/releases{/id}","created_at":"2013-01-18T18:10:57Z","updated_at":"2015-03-31T21:58:33Z","pushed_at":"2015-03-31T21:58:32Z","git_url":"git://github.com/docker/docker.git","ssh_url":"git@github.com:docker/docker.git","clone_url":"https://github.com/docker/docker.git","svn_url":"https://github.com/docker/docker","homepage":"http://www.docker.com","size":161801,"stargazers_count":20430,"watchers_count":20430,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4570,"mirror_url":null,"open_issues_count":864,"forks":4570,"open_issues":864,"watchers":20430,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/9176"},"html":{"href":"https://github.com/docker/docker/pull/9176"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/9176"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/9176/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/9176/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/9176/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/7af13a497e1f4ea0ac77aeb480b56a2bc9aefbcb"}}}}