daemon: Allow Proxy Configuration in daemon.json#26318
daemon: Allow Proxy Configuration in daemon.json#26318dave-tucker wants to merge 1 commit intomoby:masterfrom
Conversation
|
What's the usecase for this? |
|
@duglin it's described quite well in #26234 |
|
A note to maintainers... I'm still working on this, but pushing very early to try and get the tests running on CI as building locally is proving difficult for some reason |
|
Can we use daemon labels instead of daemon env vars? For proxy settings, I think perhaps it should be tied to a network rather than the daemon |
|
Thinking about this... I'm wondering about people who are very sensitive to the env vars in their containers - they might be annoyed with new ones showing up that they have no control over. One of the benefits of containers/images is that I can know for sure exactly what the container will look like. With this I lose that control. I can see providers injecting all sorts of things into people containers with this feature and container owner can't stop it. Today new env vars can be injected (via |
|
@duglin if you set things on the daemon, that is opt in too as far as I see it. Ok it is one step removed, but we allow a lot of defaults to be set there. I think the idea here was you would be able to unset them with |
|
That's a different level of opt-in sure, but then you would require each person (on each host) to modify their run cmd based on that host's daemon env vars. Keep in mind there are envs where the person doing the 'docker run' isn't the same person who owns the machine so they have no idea what daemon-level env vars might be set until its too late. And in a swarm setup if there are variants between each host's env var list (which I hope wouldn't be true, but ya never know) then since the host my app is put is on is random, there may be no way for me to unset things in a consistent way. Client-side "docker run" and config file options to specify this (either opt-in or out depending on which default is chosen at the host level) would really help and give the person managing the container the control they need. |
|
We discussed this in a maintainers review session, and we're not sure about this; if the introspection API is implemented, this would probably allow the daemon to obtain this information as well, and may be a cleaner approach (#26331). Would that solve the use case? Also, perhaps this is something for Swarm (dynamically set environment variables, based on where a container is scheduled?) |
|
ping @dave-tucker ^^ wdyt? |
|
@thaJeztah Introspection doesn't work for this use case... Unfortunately, only environment variables will cut it as this is what the applications are already expecting. While it could theoretically be implemented in Swarm it wouldn't fix the use case for a single daemon... unless if were a Swarm of one of course. |
|
Updated this PR. It now works! ... but I'm having some trouble with |
|
@thaJeztah time to discuss again? |
|
@LK4D4 @dave-tucker yeah, I'm not convinced on the "any env var" use case. We were discussing a use case for allowing just For example, what happens if I set |
|
We discussed this in the maintainers meeting, and we are ok with adding just the We do have one concern; how can we unset an environment variable on a single container? We need to have a solution for that before merging / going ahead |
|
@tianon just came up with another question; are these env-vars baked in into images I build on that daemon? For build, we have |
|
@thaJeztah simple, order of overrides is as follows:
So to override you may either bake an env variable in to an image or supply it at runtime with I hadn't considered the
IMO, the resulting image should not bake in the |
We should look at unsetting though;
No, build-args are specifically designed to not be persisted in the image; that way you can set a proxy during build, but don't have it persisted in the final image. build-args are visible in the image's history though (something to take into account), because they are prefixed for each run; They don't persist in the image layers, unless I make them (e.g. |
|
@thaJeztah thanks. In relation to We can either: My original intention was a), but I'd be happy to look at implementing b). |
|
ping @dave-tucker @thaJeztah @tianon what is the status here ? |
|
@vdemeester well, the code has bit-rotted quite substantially since I opened the PR 😨 |
integration-cli/daemon/daemon.go
Outdated
cli/command/system/info.go
Outdated
There was a problem hiding this comment.
Since len(nil) always returns 0, you don't need to check nil here
There was a problem hiding this comment.
deleted my comment as I see what you mean now :)
|
Addressed feedback from @AkihiroSuda and @thaJeztah. |
cd5ee44 to
1906094
Compare
|
Running tests locally... hmmmm..... |
|
Remind me of the Docker make command to run the tests for a specific package? |
|
for integration tests : |
These variables get propagted inside containers run on this engine to allow proxy settings to be set globally - per engine. Signed-off-by: Dave Tucker <[email protected]>
|
Excuse my clumsy rebasing |
|
@vdemeester the |
|
Windows CI failures appear unrelated |
|
Left a comment in #30588 (comment) |
|
Closing this one as well for now (#30588 (comment)), but we'll definitely want some options for this, so ping me as well to re-open 🤗 |
|
I'm sure @alexellis will remind us as well 😄 |
Updated 30/01/2016 to reflect the current state of this PR
- What I did
Added a new configuration option to allow proxy settings to be configured at the daemon level and inherited by every container that's run.
- How I did it
Added a new
proxyEnvfield to theDaemonstruct and piggybacked on the existing implementation of environment injection used bylinks.- How to verify it
There are tests! But you can manually verify by:
proxy-envin yourdaemon.jsondocker run --rm -it alpine env- Description for the changelog
Allowed a set of environment variables to be configured that allow the setting of HTTP/HTTPS/FTP proxy settings of every container run on this host.
- A picture of a cute animal (not mandatory but encouraged)
