Skip to content

Conversation

@dave-tucker
Copy link
Contributor

This is a redux of #30588 rebased and after the repo move!

- What I did

Added a mechanism to allow HTTP/HTTPS/FTP/NO proxy variables to be configured in config.json. These are then automatically populated in a docker run command as environment variables or as build-args in docker build!

This makes it easier for users suffering behind an HTTP Proxy as they only need to configure this once as opposed to creating custom aliases or forgetting the args and being denied buildage/runnage.

Updates #30323

- How I did it

Extended the configfile with some new proxy related variables.

These are scoped per Docker Host with a default catchall.

The config file is then read by the build or run command and the necessary variables are exported.

A -e flag or --build-arg provided on the CLI will override these default settings.

- How to verify it

There are integration tests! But manually, you may:

  1. Create a config.json with { "proxies" : { "httpProxy" : "http://127.0.0.1:3001" }
  2. Create a Dockerfile
FROM busybox
RUN echo $HTTP_PROXY
CMD echo $HTTP_PROXY
  1. docker --config /path/to/config build -t configtest .
  2. Verify that the HTTP_PROXY variable is as configured
  3. docker run --rm configtest env
  4. Verify that the HTTP_PROXY variable is as configured

- Description for the changelog

Added HTTP/HTTPS/FTP proxy configuration to config.json

- A picture of a cute animal (not mandatory but encouraged)

This commit modifies config.json to allow for any proxies allowed in
build-args to be configured. These values will then be used
by default as build-args in docker build.

Signed-off-by: Dave Tucker <dt@docker.com>
@dave-tucker
Copy link
Contributor Author

!rebuild powerpc #33041

Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll probably want to re-open this on docker/cli since this code is moving soon.

I think this can be tested with unit tests, it shouldn't need an integration test

@dave-tucker
Copy link
Contributor Author

Closing to re-open against docker/cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants