Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
seepine opened this issue Oct 21, 2024 · 1 comment
Open
3 tasks done

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

seepine opened this issue Oct 21, 2024 · 1 comment

Comments

@seepine
Copy link

seepine commented Oct 21, 2024

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

@seepine
Copy link
Author

seepine commented Oct 21, 2024

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 

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

No branches or pull requests

1 participant