Enhancement: add proxy configuration to contexts
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 2.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
The docker cli allows configuring proxy servers to be used when creating containers (I don't think services/stacks currently use this feature, but that could be something to consider). This feature was implemented in https://github.com/docker/cli/pull/93 (Docker 17.07).
The existing feature allows you to define which proxies should be used for a specific connection
For example, the following example defines which proxies to use when deploying a container on development.corp.example.com or production.corp.example.com, but on any other connection ( default), no proxies will be used.
{
"proxies": {
"default": {
},
"tcp://development.corp.example.com:2376": {
"HTTPProxy" :"http://dev-proxy.example.com:3128",
"HTTPSProxy" :"https://user:password@dev-proxy.example.com:3129",
"FTPProxy" :"http://dev-ftpproxy.example.com:21",
"NoProxy" :"*.intra.example.com",
},
"tcp://production.corp.example.com:2376": {
"HTTPProxy" :"http://proxy.example.com:3128",
"HTTPSProxy" :"https://user:password@proxy.example.com:3129",
"FTPProxy" :"http://ftpproxy.example.com:21",
}
}
}
Now that we have contexts, there's two separate locations to maintain configuration for environments;
- define a context for the
development.corp.example.comandproduction.corp.example.comconnections - define which proxies to use for each in the
~/.docker/config.json
Proposal
Extend the context spec to support proxy-configurations per context. This will not only solve the issue mentioned above, but also allows (e.g.) and administrator to provide a .context file, containing the correct proxy-configuration that a user should use.
Note perhaps there are other configurations to consider in future (perhaps default labels to apply to containers, or even default
memoryorcpuconstraints). When designing this feature (where to put it in the context), I think it would be good to take future expansion into account (e.g. adefaultssection under which more container-configurations can be added, but also if those defaults apply to containers, services (or both)
We should also consider what to do with the existing configuration in ~/.docker/config.json; we can deprecate the "per host" setting (still support it, but add a note that docker context is the future direction if we feel that's the case)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the Docker CLI proxy configuration described in docker/cli#93, then inspect how contexts and ~/.docker/config.json are currently represented. The proposal needs an agreed context specification, treatment of existing per-host settings, and a defined scope for container or service defaults before implementation can be considered done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100