Skip to content

The driver-opts of env.http_proxy can not work. #1241

Closed

Description

@seepine

Contributing guidelines

I've found a bug, and:

  • The documentation does not mention anything about my problem
  • There are no open or closed issues that are related to my problem

Description

The Dockerfile

FROM nginx:1.25-alpine-slim

COPY ./dist /html
RUN chmod -R 755 /html

Expected behaviour

It can build success

Actual behaviour

cannot build

Repository URL

No response

Workflow run URL

No response

YAML workflow

name: CI

on:
  push:
    tags:
      - v*

jobs:
  build-image:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 1

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3

      - name: Set up Docker BuildX
        uses: docker/setup-buildx-action@v3
        with:
            driver-opts: |
              env.http_proxy=${{ env.http_proxy }}
              env.https_proxy=${{ env.http_proxy }}
              "env.no_proxy='${{ env.no_proxy}}'"

      - name: Login to DockerHub
        uses: docker/login-action@v3
        with:
          registry: ${{ env.DOCKER_REGISTRY }}
          username: ${{ env.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      - name: Build and push
        uses: docker/build-push-action@v4
        with:
          context: .
          file: ./Dockerfile
          platforms: |
            linux/amd64
            linux/arm64            
          push: true
          tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_USERNAME }}/front-app:latest
          build-args: |
            "http_proxy=${{ env.http_proxy }}"
            "https_proxy=${{ env.http_proxy }}"

Workflow logs

[command]/usr/bin/docker buildx build --build-arg http_proxy=http://192.168.3.29:7890 --build-arg https_proxy=http://192.168.3.29:7890 --file ./Dockerfile --iidfile /tmp/docker-actions-toolkit-eCr2D4/build-iidfile-d1d8cd309c.txt --platform linux/amd64,linux/arm64 --attest type=provenance,mode=max,builder-id=https://git.example/user/front-app/actions/runs/12435/attempts/1 --tag git.example/user/front-app:latest --metadata-file /tmp/docker-actions-toolkit-eCr2D4/build-metadata-758931957d.json .
#0 building with "builder-66fcddf6-c62c-4a34-8816-a78edd01421b" instance using docker-container driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 515B done
#1 DONE 0.0s
#2 [linux/amd64 internal] load metadata for docker.io/library/nginx:1.25-alpine-slim
#2 ERROR: failed to do request: Head "https://registry-1.docker.io/v2/library/nginx/manifests/1.25-alpine-slim": EOF
#3 [linux/arm64 internal] load metadata for docker.io/library/nginx:1.25-alpine-slim
#3 CANCELED
------
 > [linux/amd64 internal] load metadata for docker.io/library/nginx:1.25-alpine-slim:
------
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:2
--------------------
   1 | >>> FROM nginx:1.25-alpine-slim
   2 | 
   3 |     RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
--------------------
ERROR: failed to solve: nginx:1.25-alpine-slim: failed to resolve source metadata for docker.io/library/nginx:1.25-alpine-slim: failed to do request: Head "https://registry-1.docker.io/v2/library/nginx/manifests/1.25-alpine-slim": EOF
::group::Reference
builder-66fcddf6-c62c-4a34-8816-a78edd01421b/builder-66fcddf6-c62c-4a34-8816-a78edd01421b0/sxjvzrt3xvzjy9ijkrpav6wtl
::endgroup::
::group::Check build summary support
Build summary is not yet supported on GHES
::endgroup::
::error::buildx failed with: ERROR: failed to solve: nginx:1.25-alpine-slim: failed to resolve source metadata for docker.io/library/nginx:1.25-alpine-slim: failed to do request: Head "https://registry-1.docker.io/v2/library/nginx/manifests/1.25-alpine-slim": EOF

BuildKit logs

No response

Additional info

No response

Activity

  1. seepine commented on Oct 21, 2024

    @seepine
    Author

    The curl

    root@ubuntu:~/apps$ curl -v https://registry-1.docker.io/v2/library/nginx/manifests/1.25-alpine-slim
    * Uses proxy env variable https_proxy == 'http://192.168.3.29:7890'
    *   Trying 192.168.3.29:7890...
    * Connected to (nil) (192.168.3.29) port 7890 (#0)
    * allocate connect buffer!
    * Establish HTTP proxy tunnel to registry-1.docker.io:443
    > CONNECT registry-1.docker.io:443 HTTP/1.1
    > Host: registry-1.docker.io:443
    > User-Agent: curl/7.81.0
    > Proxy-Connection: Keep-Alive
    > 
    < HTTP/1.1 200 Connection established
    < 
    * Proxy replied 200 to CONNECT request
    * CONNECT phase completed!
    * ALPN, offering h2
    * ALPN, offering http/1.1
    *  CAfile: /etc/ssl/certs/ca-certificates.crt
    *  CApath: /etc/ssl/certs
    * TLSv1.0 (OUT), TLS header, Certificate Status (22):
    * TLSv1.3 (OUT), TLS handshake, Client hello (1):
    * OpenSSL SSL_connect: 连接被对方重设 in connection to registry-1.docker.io:443 
    * Closing connection 0
    * TLSv1.0 (OUT), TLS header, Unknown (21):
    * TLSv1.3 (OUT), TLS alert, decode error (562):
    curl: (35) OpenSSL SSL_connect: 连接被对方重设 in connection to registry-1.docker.io:443 
  2. crazy-max commented on Jul 1, 2026

    @crazy-max
    Member

    This looks like BuildKit registry/source resolution rather than a build-push-action issue.

    The failure happens while resolving FROM nginx:1.25-alpine-slim, before Dockerfile build steps run. Proxy build args like http_proxy/https_proxy are for build steps and do not configure BuildKit's registry resolver. Docker's docs describe those as proxy build arguments for the build itself: https://docs.docker.com/build/building/variables/#proxy-arguments

    If the goal is to use a Docker Hub mirror, configure the BuildKit daemon instead, for example through setup-buildx-action's buildkitd-config-inline:

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3
      with:
        buildkitd-config-inline: |
          [registry."docker.io"]
            mirrors = ["https://your-mirror.example.com"]

    Docs: https://docs.docker.com/build/ci/github-actions/configure-builder/#registry-mirror and https://docs.docker.com/build/buildkit/configure/#registry-mirror

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