{"action":"created","comment":{"url":"https://api.github.com/repos/docker/docker/pulls/comments/37446941","id":37446941,"diff_hunk":"@@ -134,28 +134,29 @@ func NewCommand(parts ...string) *Command {\n // Here, \"portable\" means \"independent from the host we are running on\".\n // Non-portable information *should* appear in HostConfig.\n type Config struct {\n-\tHostname        string                // Hostname\n-\tDomainname      string                // Domainname\n-\tUser            string                // User that will run the command(s) inside the container\n-\tAttachStdin     bool                  // Attach the standard input, makes possible user interaction\n-\tAttachStdout    bool                  // Attach the standard output\n-\tAttachStderr    bool                  // Attach the standard error\n-\tExposedPorts    map[nat.Port]struct{} // List of exposed ports\n-\tPublishService  string                // Name of the network service exposed by the container\n-\tTty             bool                  // Attach standard streams to a tty, including stdin if it is not closed.\n-\tOpenStdin       bool                  // Open stdin\n-\tStdinOnce       bool                  // If true, close stdin after the 1 attached client disconnects.\n-\tEnv             []string              // List of environment variable to set in the container\n-\tCmd             *Command              // Command to run when starting the container\n-\tImage           string                // Name of the image as it was passed by the operator (eg. could be symbolic)\n-\tVolumes         map[string]struct{}   // List of volumes (mounts) used for the container\n-\tVolumeDriver    string                // Name of the volume driver used to mount volumes\n-\tWorkingDir      string                // Current directory (PWD) in the command will be launched\n-\tEntrypoint      *Entrypoint           // Entrypoint to run when starting the container\n-\tNetworkDisabled bool                  // Is network disabled\n-\tMacAddress      string                // Mac Address of the container\n-\tOnBuild         []string              // ONBUILD metadata that were defined on the image Dockerfile\n-\tLabels          map[string]string     // List of labels set to this container\n+\tHostname         string                       // Hostname\n+\tDomainname       string                       // Domainname\n+\tUser             string                       // User that will run the command(s) inside the container\n+\tAttachStdin      bool                         // Attach the standard input, makes possible user interaction\n+\tAttachStdout     bool                         // Attach the standard output\n+\tAttachStderr     bool                         // Attach the standard error\n+\tExposedPorts     map[nat.Port]struct{}        // List of exposed ports\n+\tPublishService   string                       // Name of the network service exposed by the container\n+\tTty              bool                         // Attach standard streams to a tty, including stdin if it is not closed.\n+\tOpenStdin        bool                         // Open stdin\n+\tStdinOnce        bool                         // If true, close stdin after the 1 attached client disconnects.\n+\tEnv              []string                     // List of environment variable to set in the container\n+\tCmd              *Command                     // Command to run when starting the container\n+\tImage            string                       // Name of the image as it was passed by the operator (eg. could be symbolic)\n+\tVolumes          map[string]struct{}          // List of volumes (mounts) used for the container\n+\tVolumeDriver     string                       // Name of the volume driver used to mount volumes\n+\tWorkingDir       string                       // Current directory (PWD) in the command will be launched\n+\tEntrypoint       *Entrypoint                  // Entrypoint to run when starting the container\n+\tNetworkDisabled  bool                         // Is network disabled\n+\tMacAddress       string                       // Mac Address of the container\n+\tOnBuild          []string                     // ONBUILD metadata that were defined on the image Dockerfile\n+\tLabels           map[string]string            // List of labels set to this container\n+\tAllowedBuildArgs map[string]map[string]string // list of build-time args that are allowed for expansion/substitution and passing to commands in 'run'.","path":"runconfig/config.go","position":48,"original_position":48,"commit_id":"6b6a7612c36589bf8528feb9dd5bd61c099af40f","original_commit_id":"c1f378dc705ba502198593e73092dc73d4945b57","user":{"login":"icecrime","id":1564054,"avatar_url":"https://avatars.githubusercontent.com/u/1564054?v=3","gravatar_id":"","url":"https://api.github.com/users/icecrime","html_url":"https://github.com/icecrime","followers_url":"https://api.github.com/users/icecrime/followers","following_url":"https://api.github.com/users/icecrime/following{/other_user}","gists_url":"https://api.github.com/users/icecrime/gists{/gist_id}","starred_url":"https://api.github.com/users/icecrime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icecrime/subscriptions","organizations_url":"https://api.github.com/users/icecrime/orgs","repos_url":"https://api.github.com/users/icecrime/repos","events_url":"https://api.github.com/users/icecrime/events{/privacy}","received_events_url":"https://api.github.com/users/icecrime/received_events","type":"User","site_admin":false},"body":"Sorry I don't really have time to think about this in depth. I agree it's embarrassing to have build specific attributes here, because build should really be a detail (we should assume it's just one of many ways to create an image). Inspecting arguments is a great feature, but I believe it should only make sense for images: it seems we are suffering here from the fact that images and containers configuration are conflated. I'm not sure what the proper solution, but I'd fine delaying arguments inspection and/or drop build args inheritance to a later PR if that makes the decision easier.","created_at":"2015-08-19T18:04:40Z","updated_at":"2015-08-19T18:04:40Z","html_url":"https://github.com/docker/docker/pull/15182#discussion_r37446941","pull_request_url":"https://api.github.com/repos/docker/docker/pulls/15182","_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/comments/37446941"},"html":{"href":"https://github.com/docker/docker/pull/15182#discussion_r37446941"},"pull_request":{"href":"https://api.github.com/repos/docker/docker/pulls/15182"}}},"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/15182","id":41292985,"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","issue_url":"https://api.github.com/repos/docker/docker/issues/15182","number":15182,"state":"open","locked":false,"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},"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.","created_at":"2015-07-30T23:19:13Z","updated_at":"2015-08-19T18:04:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"667fd69d68ee7b1d713cc30b31816b16e68c2f96","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/docker/pulls/15182/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/15182/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/15182/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/6b6a7612c36589bf8528feb9dd5bd61c099af40f","head":{"label":"mapuri:build-arg","ref":"build-arg","sha":"6b6a7612c36589bf8528feb9dd5bd61c099af40f","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-05-07T22:53:52Z","pushed_at":"2015-08-19T16:45:02Z","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":65841,"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":"ca795765859b8560ab3d1a0ff31338d84b3c69a5","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-08-19T16:41:12Z","pushed_at":"2015-08-19T17:26:33Z","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":243612,"stargazers_count":24144,"watchers_count":24144,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6154,"mirror_url":null,"open_issues_count":1038,"forks":6154,"open_issues":1038,"watchers":24144,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/15182"},"html":{"href":"https://github.com/docker/docker/pull/15182"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/15182"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/15182/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/15182/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/15182/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/6b6a7612c36589bf8528feb9dd5bd61c099af40f"}}}}