Docker Proxy Setup: Containers, Builds and Pulls
Choose the correct Docker proxy setting for application traffic, build steps or image pulls. Includes runtime examples, NO_PROXY checks and credential handling.
By Proxies.sx Team. Reviewed .
Choose the process that makes the failing request. Container application traffic, Dockerfile build steps and Docker daemon image pulls have separate proxy configuration paths. Changing one does not configure every layer.
In this guide
Match the failure to the Docker layer
| What fails | Where to investigate | What the setting affects |
|---|---|---|
| A script inside a running container | Container environment and the script's HTTP client | Clients in that container that use those settings |
| A RUN step during a build | Build proxy arguments and the command inside the step | Build-time requests made with those arguments |
| docker pull | Docker daemon or Docker Desktop proxy configuration | Daemon-managed access to the image registry |
A successful image pull does not prove that your Python or Node application reads a proxy variable. A working application proxy also does not configure the daemon's registry connection. Docker documents container proxy settings and daemon proxy settings separately.
Pass settings to a new container
Populate the proxy variables in the host environment using your secret-management workflow. The command below passes their values by name. Its Python code prints only whether each variable is populated; it makes no network request.
We ran this check in a disposable container with networking disabled and confirmed the three values arrived. That verifies environment injection, not a proxied request. Use your application's actual HTTP client for the next check.
docker run --rm --network none \
--env HTTP_PROXY --env HTTPS_PROXY --env NO_PROXY \
python:3.12-alpine python -c \
'import os; print({k: bool(os.getenv(k)) for k in ("HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY")})'
# Inspect the result, then test a request in your real application image.The application still chooses whether to use the proxy
Docker does not turn a proxy environment variable into a network-wide interception rule. Your application's client must read the setting. In our local comparison, HTTPX read proxy variables by default, aiohttp required trust_env=True, and Node fetch required environment-proxy opt-in.
Use the matching HTTPX, aiohttp or Node fetch example in your application image. If the client is curl, remember its lowercase http_proxy requirement for HTTP targets. An uppercase-only runtime example is not a universal configuration for every application.
A changed environment applies to a newly created container. Recreate the relevant workload rather than assuming that editing your shell updates a running process. For internal service requests, check NO_PROXY matching against the host name actually used in the URL.
Use build arguments for build-time proxy settings
Docker supports predefined proxy build arguments. Pass them through the build command or the Docker client configuration. The build command can read an argument value from the host environment when you pass its name alone. The example below assumes those variables are already set; it does not write their values into the command text.
The build reference explains the special handling of proxy arguments. Referencing them in the Dockerfile can change their cache and history treatment. Avoid an ENV instruction that embeds a proxy password into the resulting image. A build command can still leak values if it prints its environment.
docker build \
--build-arg HTTP_PROXY \
--build-arg HTTPS_PROXY \
--build-arg NO_PROXY \
--tag my-application .Configure image pulls at the daemon layer
On a Docker Engine host, the daemon has its own documented proxy settings, including daemon.json options and startup environment. Docker Desktop has its own proxy settings; Docker's daemon guide states that daemon proxy configuration in daemon.json is ignored by Desktop.
Use the instructions for the installation you run. Restarting a shared daemon can interrupt work, so coordinate that change with its operator. Do not make a daemon-wide change merely because one container's library ignored its environment.
Docker also warns that proxy credentials in client configuration and container environment are stored as plaintext and may be visible through inspection. Restrict access, avoid logging full values, and use the deployment's supported secret handling. A secret mount still needs application code that reads it.
What this guide verifies
The Docker test record covers environment injection with networking disabled. The client-routing observations come from the separate local proxy fixture. We did not change the Docker daemon, test registry pulls through a proxy, or claim a paid Proxies.sx container deployment.
For a real deployment, validate the request from the process that performs it, then check the expected response. Once configuration works, use the bandwidth calculator with measured traffic and your current quoted rate.
Common questions
Does ~/.docker/config.json configure the daemon proxy?
Its proxies section supplies environment variables and build arguments for new containers and builds. Docker documents daemon and Desktop proxy configuration separately.
Can I use one NO_PROXY value for every container?
Only after checking the clients and destination names in those containers. Matching rules differ, and an entry should describe the target host rather than the proxy endpoint.
Sources and test scope
Official documentation checked on 14 October 2026. The linked local test records identify the tested versions and limits. The examples do not establish public proxy availability or destination acceptance.
- Docker client proxy settings
- Docker daemon and Desktop differences
- Docker predefined proxy build arguments
- docker run environment options
- Docker build argument environment inheritance
Machine-readable guide index and local routing test results.
Connect your application to Proxies.sx
Use the username builder for gateway routing fields and the format converter for existing connection lists. Review Pool Gateway documentation, then check current mobile stock before buying traffic.
For agent-driven workflows, the agent service index lists the supported APIs. A configured HTTP client still needs to validate its task's response.
Configure the client that sends your requests
Start with the proxy configuration guide, or open the setup for your runtime.