Integration · HTTP clients
Use a proxy in Docker containers
To send a container's traffic through a proxy, pass HTTPS_PROXY, HTTP_PROXY and NO_PROXY into it: docker run -e HTTPS_PROXY=http://user:pass@host:port …. For builds, the same names are predefined build arguments. Docker itself does not route anything; the HTTP clients inside the container read the variables. The daemon's own proxy setting is a separate thing that only affects image pulls.
Reviewed 30 Oct 2026
http://USERNAME _pool-arcfast _country-de:PASSWORD@ proxy.arcproxies.io:8000The short answer
- Containers:
-e HTTPS_PROXY=…(andHTTP_PROXY,NO_PROXY), orproxiesin~/.docker/config.jsonfor every new container. - Builds:
--build-arg HTTPS_PROXY=…; predefined proxy args stay out ofdocker historyand the image. - The daemon proxy (
daemon.json) is for pulling images, not for your containers' traffic. docker inspectshows-evalues in plain text, credentials included.
Setup
Set up Docker with a proxy, step by step
- 01
Run one container through the gateway
Set the variable in the container and check the exit IP. The image's HTTP client must honour the variables; curl, Python's standard library, Go and most package managers do, while Node.js needs extra setup.
shell6 linesdocker run --rm \ -e HTTPS_PROXY="http://USERNAME_pool-arcfast_country-de:PASSWORD@proxy.arcproxies.io:8000" \ -e HTTP_PROXY="http://USERNAME_pool-arcfast_country-de:PASSWORD@proxy.arcproxies.io:8000" \ -e NO_PROXY="localhost,127.0.0.1" \ python:3.12-slim \ python -c "import urllib.request; print(urllib.request.urlopen('https://api.ipify.org?format=json', timeout=20).read())" - 02
Keep the credentials in an env file
An env file keeps the password out of shell history. Set lowercase variants too: some tools read only one case, and curl reads plain-HTTP proxies only from lowercase
http_proxy.shell11 linescat > arc.env <<'EOF'HTTPS_PROXY=http://USERNAME_pool-arcfast_country-de:PASSWORD@proxy.arcproxies.io:8000https_proxy=http://USERNAME_pool-arcfast_country-de:PASSWORD@proxy.arcproxies.io:8000HTTP_PROXY=http://USERNAME_pool-arcfast_country-de:PASSWORD@proxy.arcproxies.io:8000http_proxy=http://USERNAME_pool-arcfast_country-de:PASSWORD@proxy.arcproxies.io:8000NO_PROXY=localhost,127.0.0.1no_proxy=localhost,127.0.0.1EOFchmod 600 arc.envdocker run --rm --env-file arc.env curlimages/curl -s https://api.ipify.org - 03
Use the proxy during a build
Pass it as a build argument.
HTTP_PROXY,HTTPS_PROXY,NO_PROXYand their lowercase forms are predefined, so the Dockerfile needs noARGline; Docker excludes them fromdocker historyand does not cache them, so a changed value does not rebuild cached layers. Never useENVfor a proxy: that bakes it into the image.shell4 linesdocker build \ --build-arg HTTPS_PROXY="http://USERNAME_pool-arcfast_country-de:PASSWORD@proxy.arcproxies.io:8000" \ --build-arg NO_PROXY="localhost,127.0.0.1" \ -t my-scraper . - 04
Configure services in Compose
Keep the URL in a
.envfile next to the Compose file and reference it. List the other services' names inNO_PROXY, or calls from the scraper to your own API or database admin UI go out through the gateway too.compose.yaml15 lines# .env: ARC_PROXY_URL=http://USERNAME_pool-arcfast_country-de:PASSWORD@proxy.arcproxies.io:8000services: scraper: build: context: . args: HTTPS_PROXY: ${ARC_PROXY_URL} environment: HTTPS_PROXY: ${ARC_PROXY_URL} HTTP_PROXY: ${ARC_PROXY_URL} NO_PROXY: localhost,127.0.0.1,api,db api: image: my-api db: image: postgres:17 - 05
Give each container its own exit or market
The username is per container, so containers can hold different sticky sessions or countries. Cities come from the published list, lowercased without spaces.
shell7 linesfor market in de-berlin gb-london us-chicago; do cc=${market%%-*}; city=${market#*-} user="USERNAME_pool-arcfast_country-${cc}_city-${city}_session-${cc}${city}_sesstime-30" docker run -d --name "worker-${market}" \ -e HTTPS_PROXY="http://${user}:PASSWORD@proxy.arcproxies.io:8000" \ my-scraperdone
Container, build and daemon proxies are three different settings
| Setting | Where | Affects |
|---|---|---|
| Container environment | docker run -e, --env-file, Compose environment | HTTP clients inside that container |
| Client config | proxies.default in ~/.docker/config.json | Sets the variables in every new container and build |
| Build arguments | docker build --build-arg, Compose build.args | RUN steps during the build only |
| Daemon | daemon.json proxies or a systemd drop-in | Image pulls and pushes by dockerd; ignored by Docker Desktop |
Docker Desktop has its own proxy settings under Settings → Resources → Proxies. Pulling images through a per-GB residential proxy rarely makes sense; leave the daemon on a direct connection and proxy only the scraping traffic.
What the variables do and do not cover
There is no standard for proxy variables, and Docker's documentation says so. Most clients read HTTPS_PROXY for https:// URLs and send a CONNECT request with the credentials from the URL; NO_PROXY formats differ, for example whether .example.com matches subdomains or CIDR ranges are understood. Headless browsers are configured through their automation library's proxy option instead; the Playwright and scrapy-playwright guides show those.
Rotating plans authenticate by username and password only, with no IP allowlisting, so every container needs the credentials. Treat them as secrets: Docker stores container environment variables in plain text, readable with docker inspect and preserved by docker commit.
The problem
Common pitfalls
ENV in the Dockerfile
ENV HTTPS_PROXY=... ends up in the image and every container started from it. Use --build-arg for builds and runtime variables for containers.
Service names missing from NO_PROXY
Containers call each other by service name. Without those names in NO_PROXY, internal calls go to the gateway and fail or cost bandwidth.
Configuring the daemon and expecting containers to follow
daemon.json proxies affect dockerd's own pulls. Containers only see a proxy through their environment or the client config.
Special characters in the password
The password sits in a URL. Percent-encode @, : and /; in a systemd drop-in for the daemon, Docker's docs say the escapes need a doubled %%.
FAQ
Questions
Something not covered? Write to contact@arcproxies.io.
How do I set a proxy for a Docker container?
Pass the variables when you start it: docker run -e HTTPS_PROXY=http://user:pass@host:port -e HTTP_PROXY=... -e NO_PROXY=localhost image. Or set proxies in ~/.docker/config.json to add them to every new container.
How do I use a proxy during docker build?
Use docker build --build-arg HTTPS_PROXY=http://user:pass@host:port .. The proxy variables are predefined build arguments, available to RUN steps and excluded from docker history.
Does the Docker daemon proxy apply to containers?
No. The daemon proxy in daemon.json or a systemd drop-in is what dockerd uses to pull images. Container traffic uses the variables passed into the container.
Are proxy credentials safe in Docker environment variables?
They are stored in plain text in the container configuration and visible through docker inspect and the API. Limit who can talk to the Docker daemon, prefer env files over command-line values, and never bake the proxy into an image.
Sources & review
Last reviewed by the ARC Proxies team. Prices are read from the live catalog at build time.
- [1]Docker Docs: Use a proxy server with the Docker CLI
- [2]Docker Docs: Daemon proxy configuration
- [3]Docker Docs: Dockerfile reference: Predefined ARGs
- [4]curl: curl man page: Environment
Next
What people build with it
Integrations
Other http clients
Get started
Get credentials and paste them in.
Sign up, buy a gigabyte, generate a username in the dashboard. Code WELCOME15 takes 15% off your first purchase; bandwidth never expires.