{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/2316","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/2316/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/2316/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/2316/events","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/issues/2316","id":48467938,"number":2316,"title":"Images with ENTRYPOINT set can't expand environment variables in command","user":{"login":"smarterclayton","id":1163175,"avatar_url":"https://avatars.githubusercontent.com/u/1163175?v=3","gravatar_id":"","url":"https://api.github.com/users/smarterclayton","html_url":"https://github.com/smarterclayton","followers_url":"https://api.github.com/users/smarterclayton/followers","following_url":"https://api.github.com/users/smarterclayton/following{/other_user}","gists_url":"https://api.github.com/users/smarterclayton/gists{/gist_id}","starred_url":"https://api.github.com/users/smarterclayton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smarterclayton/subscriptions","organizations_url":"https://api.github.com/users/smarterclayton/orgs","repos_url":"https://api.github.com/users/smarterclayton/repos","events_url":"https://api.github.com/users/smarterclayton/events{/privacy}","received_events_url":"https://api.github.com/users/smarterclayton/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels/api/cluster","name":"api/cluster","color":"e1ed21"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels/area/usability","name":"area/usability","color":"00cc00"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels/kind/enhancement","name":"kind/enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels/priority/P1","name":"priority/P1","color":"eb6420"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels/status/help-wanted","name":"status/help-wanted","color":"159818"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels/team/UX","name":"team/UX","color":"d2b48c"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones/6","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/milestones/v1.0","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones/6/labels","id":969317,"number":6,"title":"v1.0","description":"Issues that need to be resolved for v1.0 of Kubernetes.","creator":{"login":"goltermann","id":9358478,"avatar_url":"https://avatars.githubusercontent.com/u/9358478?v=3","gravatar_id":"","url":"https://api.github.com/users/goltermann","html_url":"https://github.com/goltermann","followers_url":"https://api.github.com/users/goltermann/followers","following_url":"https://api.github.com/users/goltermann/following{/other_user}","gists_url":"https://api.github.com/users/goltermann/gists{/gist_id}","starred_url":"https://api.github.com/users/goltermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goltermann/subscriptions","organizations_url":"https://api.github.com/users/goltermann/orgs","repos_url":"https://api.github.com/users/goltermann/repos","events_url":"https://api.github.com/users/goltermann/events{/privacy}","received_events_url":"https://api.github.com/users/goltermann/received_events","type":"User","site_admin":false},"open_issues":105,"closed_issues":107,"state":"open","created_at":"2015-02-06T20:27:16Z","updated_at":"2015-03-25T20:43:14Z","due_on":null,"closed_at":null},"comments":58,"created_at":"2014-11-12T03:19:27Z","updated_at":"2015-03-25T21:57:15Z","closed_at":null,"body":"To expand environment variables, the command for a pod must use `sh` - `command: [\"sh\", \"-c\", \"${MYVAR}\"]`.  However, images with an entrypoint will not be able to use this technique, because the command array is then appended to the ENTRYPOINT instead of replacing the CMD.\r\n\r\nSaying that images with entry points can't do variable expansion seems too limiting.  We have no technique to allow a consumer to solve that problem.  Assuming that entrypoint is here to stay and an image consumer may want to either replace variables OR override the entrypoint, there are a few options:\r\n\r\n1. Allow a command to specify it should be expanded prior to execution.  Won't allow environment in the image to take effect unless we load it by introspecting the image and emulating environment support.  Will not catch ~/.bash_profile settings?\r\n2. Allow a command to be specified as a shell call, and concatenate it into a string before invoking docker.  Probably not safe, and breaks argument encapsulation (we'd have to safe shell quote).\r\n3. When command is specified, bypass entrypoint totally.  Breaks existing users who depend on arguments.  Prevents image consumers from letting the image define its default behavior and specify arguments.\r\n a. Add an option to command to treat the command as an override to entrypoint. Backwards compatible.\r\n b. Add a fake environment var to be evaluated prior to container start that substitutes the images entrypoint (`command: ['sh', '-c', '${ENTRYPOINT}', ...]')\r\n4. Add an option to command which prepends \"sh\" \"-c\".  Not guaranteed to work, not all images have \"sh\" or may have nonstandard shell paths.\r\n\r\n3 seems the most consistent (don't allow entry points) with the minor inconvenience of ignoring the preferred path of the image author.  3a seems crufty.  3b is very crufty.  1, 2, and 4 seem very crufty."},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/comments/86231038","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/issues/2316#issuecomment-86231038","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/2316","id":86231038,"user":{"login":"pmorie","id":366488,"avatar_url":"https://avatars.githubusercontent.com/u/366488?v=3","gravatar_id":"","url":"https://api.github.com/users/pmorie","html_url":"https://github.com/pmorie","followers_url":"https://api.github.com/users/pmorie/followers","following_url":"https://api.github.com/users/pmorie/following{/other_user}","gists_url":"https://api.github.com/users/pmorie/gists{/gist_id}","starred_url":"https://api.github.com/users/pmorie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmorie/subscriptions","organizations_url":"https://api.github.com/users/pmorie/orgs","repos_url":"https://api.github.com/users/pmorie/repos","events_url":"https://api.github.com/users/pmorie/events{/privacy}","received_events_url":"https://api.github.com/users/pmorie/received_events","type":"User","site_admin":false},"created_at":"2015-03-25T21:57:15Z","updated_at":"2015-03-25T21:57:15Z","body":"@smarterclayton @thockin As far as downward API resolution, I'll initially just support POD_NAME and we can add other pieces of info as we define exactly what's in the API."}}