Skip to content

docker buildx does not respect the no_proxy variable. #2667

Description

@snowdream

Contributing guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

GitHub Actions Continuous Delivery

I want ro run github acion on a self-host pc behind the proxy,but falied.

I can not pull the base image.

The proxy is fine. i can run docker buildx on the pc,but failed when i run github action on it.

Error: buildx failed with: ERROR: failed to solve: alpine:3.20.2: failed to resolve source metadata for docker.io/library/alpine:3.20.2: failed to do request: Head "https://docker.sn0wdr1am.com/v2/library/alpine/manifests/3.20.2?ns=docker.io": proxyconnect tcp: dial tcp 127.0.0.1:1080: connect: connection refused

Expected behaviour

Setup and Run github action on self-host pc behind proxy.

Actual behaviour

I can not pull the base image.

Buildx version

github.com/docker/buildx v0.16.2 99dea6d

Docker info

Client: Docker Engine - Community
 Version:    27.1.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.16.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.29.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 2
  Running: 1
  Paused: 0
  Stopped: 1
 Images: 10
 Server Version: 27.1.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8fc6bcff51318944179630522a095cc9dbf9f353
 runc version: v1.1.13-0-g58aa920
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.6.31+rpt-rpi-v8
 Operating System: Debian GNU/Linux 12 (bookworm)
 OSType: linux
 Architecture: aarch64
 CPUs: 4
 Total Memory: 907.3MiB
 Name: whitepi3bplus
 ID: a2cf9d13-dafe-4670-a02c-b654cd86d86f
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http://127.0.0.1:1080
 HTTPS Proxy: http://127.0.0.1:1080
 No Proxy: localhost,example.com,sn0wdr1am.com
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://docker.sn0wdr1am.com/
  https://quay.sn0wdr1am.com/
  https://gcr.sn0wdr1am.com/
  https://k8s-gcr.sn0wdr1am.com/
  https://k8s.sn0wdr1am.com/
  https://ghcr.sn0wdr1am.com/
  https://cloudsmith.sn0wdr1am.com/
  https://ecr.sn0wdr1am.com/
 Live Restore Enabled: false

WARNING: No memory limit support
WARNING: No swap limit support


### Builders list

```text
NAME/NODE     DRIVER/ENDPOINT                   STATUS    BUILDKIT   PLATFORMS
build         docker-container                                       
 \_ build      \_ unix:///var/run/docker.sock   running   v0.15.2    linux/arm64, linux/arm/v7, linux/arm/v6, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64
default*      docker                                                 
 \_ default    \_ default                       running   v0.15.1    linux/arm64, linux/arm/v7, linux/arm/v6, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64


### Configuration

```dockerfile
FROM alpine:3.20.2

LABEL maintainer="snowdream <sn0wdr1am@qq.com>"

# keep the docker container running
ENV KEEPALIVE=0

RUN echo "@main https://dl-cdn.alpinelinux.org/alpine/edge/main" | tee -a /etc/apk/repositories \
    && echo "@community https://dl-cdn.alpinelinux.org/alpine/edge/community" | tee -a /etc/apk/repositories \
    && echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" | tee -a /etc/apk/repositories \
    && apk add --no-cache musl-locales \
    musl-locales-lang \
    tzdata \
    openssl \
    wget \  
    ca-certificates \                                                                                                                                                                                                      
    && update-ca-certificates    

# ENTRYPOINT [ "sh", "-c", "trap : TERM INT; tail -f /dev/null & wait" ]
# ENTRYPOINT [ "sh", "-c", "trap : TERM INT; sleep infinity & wait" ]
# CMD [ "sh", "-c", "trap : TERM INT; tail -f /dev/null & wait" ]
# CMD [ "sh", "-c", "trap : TERM INT; sleep infinity & wait" ]

Build logs

https://github.com/snowdreamtech/alpine/actions/runs/10643865069/job/29507938882


https://github.com/user-attachments/files/16824011/logs_27827136796.zip

Additional info

~/.docker/config.json

{
        "auths": {},
        "proxies": {
                "default": {
                        "httpProxy": "http://127.0.0.1:1080",
                        "httpsProxy": "http://127.0.0.1:1080",
                        "noProxy": "localhost,example.com,sn0wdr1am.com"
                }
        }
}

.github/buildkitd.toml

# debug enables additional debug logging
debug = true
# trace enables additional trace logging (very verbose, with potential performance impacts)
trace = true


[registry."docker.io"]
    mirrors = ["https://docker.sn0wdr1am.com"]

[registry."quay.io"]
    mirrors = ["https://quay.sn0wdr1am.com"]

[registry."gcr.io"]
    mirrors = ["https://gcr.sn0wdr1am.com"]

[registry."k8s.gcr.io"]
    mirrors = ["https://k8s-gcr.sn0wdr1am.com"]

[registry."k8s.io"]
    mirrors = ["https://k8s.sn0wdr1am.com"]

[registry."ghcr.io"]
    mirrors = ["https://ghcr.sn0wdr1am.com"]

[registry."cloudsmith.io"]
    mirrors = ["https://cloudsmith.sn0wdr1am.com"]

[registry."ecr.aws"]
    mirrors = ["https://ecr.sn0wdr1am.com"]

[worker.oci]
  max-parallelism = 2

global proxy

export http_proxy="http://127.0.0.1:1080"
export https_proxy="http://127.0.0.1:1080"
export ftp_proxy="http://127.0.0.1:1080"
export all_proxy="http://127.0.0.1:1080"
export no_proxy="localhost,example.com,sn0wdr1am.com"
export HTTP_PROXY="http://127.0.0.1:1080"
export HTTPS_PROXY="http://127.0.0.1:1080"
export FTP_PROXY="http://127.0.0.1:1080"
export ALL_PROXY="http://127.0.0.1:1080"
export NO_PROXY="localhost,example.com,sn0wdr1am.com"

~/.config/systemd/user/docker.service.d/http-proxy.conf

/etc/systemd/system/docker.service.d/http-proxy.conf

[Service]
Environment="HTTP_PROXY=http://127.0.0.1:1080"
Environment="HTTPS_PROXY=http://127.0.0.1:1080"
Environment="NO_PROXY=localhost,example.com,sn0wdr1am.com"

/etc/docker/daemon.json

{
          "experimental": true,
    "registry-mirrors": [
    "https://docker.sn0wdr1am.com", 
    "https://quay.sn0wdr1am.com",   
    "https://gcr.sn0wdr1am.com",    
    "https://k8s-gcr.sn0wdr1am.com",    
    "https://k8s.sn0wdr1am.com",
    "https://ghcr.sn0wdr1am.com",   
    "https://cloudsmith.sn0wdr1am.com", 
    "https://ecr.sn0wdr1am.com"
  ]
}

~/actions-runner/.env

export http_proxy="http://127.0.0.1:1080"
export https_proxy="http://127.0.0.1:1080"
export ftp_proxy="http://127.0.0.1:1080"
export all_proxy="http://127.0.0.1:1080"
export no_proxy="localhost,example.com,sn0wdr1am.com"
export HTTP_PROXY="http://127.0.0.1:1080"
export HTTPS_PROXY="http://127.0.0.1:1080"
export FTP_PROXY="http://127.0.0.1:1080"
export ALL_PROXY="http://127.0.0.1:1080"
export NO_PROXY="localhost,example.com,sn0wdr1am.com"

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions