{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/16699","labels_url":"https://api.github.com/repos/docker/docker/issues/16699/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/16699/comments","events_url":"https://api.github.com/repos/docker/docker/issues/16699/events","html_url":"https://github.com/docker/docker/issues/16699","id":109296537,"number":16699,"title":"Pushing Environment Variables to all Docker Containers","user":{"login":"mwiora","id":2744285,"avatar_url":"https://avatars.githubusercontent.com/u/2744285?v=3","gravatar_id":"","url":"https://api.github.com/users/mwiora","html_url":"https://github.com/mwiora","followers_url":"https://api.github.com/users/mwiora/followers","following_url":"https://api.github.com/users/mwiora/following{/other_user}","gists_url":"https://api.github.com/users/mwiora/gists{/gist_id}","starred_url":"https://api.github.com/users/mwiora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwiora/subscriptions","organizations_url":"https://api.github.com/users/mwiora/orgs","repos_url":"https://api.github.com/users/mwiora/repos","events_url":"https://api.github.com/users/mwiora/events{/privacy}","received_events_url":"https://api.github.com/users/mwiora/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels/kind/enhancement","name":"kind/enhancement","color":"E8CAAF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-10-01T13:14:12Z","updated_at":"2015-10-01T14:41:47Z","closed_at":null,"body":"Hi @all,\r\n\r\nI'm currently working with Docker behind a HTTP Proxy.\r\nIt's great to have the option, to provide a HTTP Proxy to the Service by default. This is in case of CentOS/RedHat the File /etc/systemd/system/docker.service.d/http-proxy.conf with content:\r\n\r\n[Service]\r\nEnvironment=\"http_proxy=192.168.34.99:3128\" \"https_proxy=192.168.34.99:3128\"\r\n\r\nFor Build I have the Option to provide the Proxy using the BUILD Commands\r\n\r\nENV http_proxy 192.168.34.99:3128\r\nENV https_proxy 192.168.34.99:3128\r\n\r\nworks great!\r\n\r\nWhat did not work great for me, was providing Environment variables to all following Docker containers. This would be not only useful for setting Proxy Configuration...\r\n\r\nSo I would not have to run each container with an -e parameter (like \"-e http_proxy=192.168.34.99:3128\") but rather have this configured in a file like /etc/dockercontainerdefault.conf\r\n\r\nTell me if I just missed an existing configuration option."},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/144748649","html_url":"https://github.com/docker/docker/issues/16699#issuecomment-144748649","issue_url":"https://api.github.com/repos/docker/docker/issues/16699","id":144748649,"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-10-01T14:41:47Z","updated_at":"2015-10-01T14:41:47Z","body":"I don't think this should be in the client config, since this is too specific IMO.\r\n\r\nOne solution for this issue is (excuse my bash):\r\n```\r\n$ cat ~/.bashrc\r\n...\r\nfunction docker() {\r\n  local extra=\"-e HTTP_PROXY=1.2.3.4\"\r\n  if [ \"$1\" == \"run\" -o \"$1\" == \"create\" ]; then\r\n    c=\"$1\"\r\n    shift\r\n    $(which docker) $c $extra $*\r\n  else\r\n    $(which docker) $*\r\n  fi\r\n}\r\n$ docker run --rm ubuntu env\r\n```\r\n\r\nThe reason I don't like this or the client config solution is because it's changing the client when in fact what I think you want is to have a template that's applied to your builds. There can be interesting ideas in that direction too. However, for right now, I suggest you put the above in your bashrc.\r\n\r\nMy 2¢.."}}