Skip to content

docker compose up --build or docker compose build and config.json for proxy #8797

Closed
@bb980701

Description

@bb980701

Description

The builder of the image do not use the proxy setting set in the config.json / in the daemon or as local env variables as runtime build argument .

Steps to reproduce the issue:
0. Have a win10 coporate machine setup under windows where all internet traffic have to pass through a proxy
where
Environment variables HTTP_PROXY , HTTPS_PROXY are set at windows
Docker Desktop settings > Resources > Proxies are ser
.C:\Users<winuser>.docker\config.json proxies property are set

docker-compose.yml

version: "3.9"
services:
  agent:
    container_name: test_proxy
    build:
      context: .
      dockerfile: Dockerfile

start.sh

#!/bin/sh
set
sleep infinity

Dockerfile

FROM node:14-alpine
RUN set 
RUN apk add tzdata
RUN cp /usr/share/zoneinfo/UTC /etc/localtime
COPY ./start.sh .
RUN chmod +x start.sh
ENTRYPOINT [ "sh" , "./start.sh" ]

Describe the results you received:

a. docker compose up --build

image
at the apk add step the build hang for ever , since impossible to fetch the package

it returns a fetch error since the build process do not have the proxy env variable

looking further why , with

b. docker compose build --progress plain --no-cache

the FROM use probably the Daemon Proxy setting from the Windows Docker Desktop to get the alpine image
BUT the RUN set command show clearly that the ENV variables related to proxy are no set, know at RUN command

image

Describe the results you expected:
For me it is a regression since with Docker Desktop 3.3.3 and at that time docker-compose

image

docker-compose version 
docker-compose version 1.29.1, build c34c88b2
docker-py version: 5.0.0
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020

it was working without troubles, all command in the Dockerfile are aware of the proxy setting

docker-compose build --progress plain --no-cache

image

It works also perfectly with Docker Desktop for Win 4.1.1 when I disable :
image
and use docker-compose build command instead of docker compose build

$ docker-compose version
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020

Output of docker compose version:

$ docker compose version
Docker Compose version v2.0.0

Output of docker info:

$ docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Build with BuildKit (Docker Inc., v0.6.3)
  compose: Docker Compose (Docker Inc., v2.0.0)
  scan: Docker Scan (Docker Inc., v0.8.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 20.10.8
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: e25210fe30a0a703442421b0f60afac609f950a3
 runc version: v1.0.1-0-g4144b63
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.4.72-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 3.842GiB
 Name: docker-desktop
 ID: 3KU2:GB4V:LDZT:4KHL:XLHV:A6LY:G276:EWFA:HIX3:EPO6:EW7Q:SRF2
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy:  http://xxxxx:xxxxx@xxxxxxxxxxxxxx:800/
 HTTPS Proxy: http://xxxxx:xxxxx@xxxxxxxxxxxxxx:800/
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

Additional environment details to reproduce the bug:

windows win10

image

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions