Docker Community Forums

Share and learn in the Docker community.

Docker Compose Build Does Not Apply Proxy Settings

I have Docker for Windows running on a corporate network with the proxy which is correctly configured in the Docker settings. In a directory with a simple Dockerfile, I am able to use

docker build -t buildtest .

to build an image. This confirms the proxy is correctly configured within Docker.

When I add a docker-compose.yml file and try to do the build there, it does fails and shows the error that comes from the proxy server. It doesn’t appear to be applying the proxy settings for the build process via Docker Compose.

Setting the build args in the docker-compose.yml file does not seem to help either (that was how I used to do it with Docker Toolbox, but should probably not be necessary).

Expected behavior

I expect the following to build the image defined in the docker-compose.yml file

docker-compose build buildtest

Actual behavior

When I try to build, I get the following output

docker-compose build
Building testservice
<TITLE>Access Denied</TITLE>
Additional, proxy specific output saying the proxy failed to authenticate 
(omitted for brevity)


  • Running Docker Version 1.12.0-rc4-beta20 (build: 5579) 4b0b82c

Steps to reproduce the behavior

  1. On a machine where a corporate proxy is required, create a new directory
  2. Add Dockerfile (see below)
  3. Run the following docker build -t buildtest .
  4. Verify the image built successfully docker images
  5. Add docker-compose.yml (see below)
  6. Run docker-compose build buildtest
  7. Observe error with output from proxy


FROM alpine

RUN pwd


version: '2'
      context: .

I’m having the same problem. Is there any solution or work around for this yet?

Same. Would be nice for a Docker rep to weigh in.

Thanks for reporting this. It’s actually a little surprising that this works with docker build.

Have you tried specifying the proxy settings as build args?

Either way, we already have an issue tracking improvements to this.

Thanks for reporting!

1 Like

There are more details here:

I have this same problem and have tried using build args in the docker-compose file. Didn’t change anything, unfortunately.

Hi, this is really big problem for me, I can’t start any containers via docker-compose behind company proxy server.

Could I get you to run diagnostics and post them on this issue which seems related:

+1 - This is a fairly big issue for me. My team’s build server sits in AWS under a different network topology from the corporate office network. The proxy settings aren’t needed in AWS, but if I pull down the code to run locally I cannot docker-compose build without manual intervention. Without this feature, portability, and especially corporate development, are significantly hindered.

Was there any solution for this problem. I am still facing issues while doing compose build. Image builds successfully with docker build. please find the command and error below

C:> docker-compose --verbose -f “C:\local\docker-compose.yml” build

compose.config.config.find: Using configuration files: C:\local\docker-compose.yml
docker.auth.find_config_file: Trying paths: ['C:\\Users\\admin\\.docker\\config.json', 'C:\\Users\\admin\\.dockercfg']
docker.auth.find_config_file: No config file found
Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose\cli\", line 68, in main
  File "compose\cli\", line 118, in perform_command
  File "compose\cli\", line 37, in project_from_options
  File "compose\cli\", line 99, in get_project
  File "compose\cli\", line 74, in get_client
  File "site-packages\docker\api\", line 177, in version
  File "site-packages\docker\utils\", line 46, in inner
  File "site-packages\docker\api\", line 189, in _get
  File "site-packages\requests\", line 488, in get
  File "site-packages\requests\", line 475, in request
  File "site-packages\requests\", line 617, in send
  File "site-packages\requests\", line 177, in resolve_redirects
  File "site-packages\requests\", line 596, in send
  File "site-packages\requests\", line 499, in send
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='', port=8080): Read timed out. (read timeout=60)
Failed to execute script docker-compose

I’m having the same issue on Linux. I have set the proxies in ~/.docker/config.json but the values seem to be ignored by docker-compose.

Manually setting them using build/args in docker-compose.yml does not seem to work either. I have:

version: "2"
      context: .
        - http_proxy = "http://localproxy.localdomain",
        - https_proxy = "https://localproxy.localdomain",
        - no_proxy = ".our.local.domain,localhost",


Same problem here. But I’m using version 3 (I’ve tried build args). No way to get internet connection behind a proxy:

version: '3'

    image: bitnami/jenkins:latest
      - 8090:8080
      - 8443:8443

I also tried the instructions here, but no luck with it.

1 Like

If I can be of assistance. Had this same issue, but referencing a solution for the docker build command.

docker-compose build --build-arg HTTP_PROXY=http://proxyurl:proxyport --build-arg HTTPS_PROXY=http://proxyurl:proxyport

This worked for me. More details can be found here