authentication fail using docker build behind proxy

最近用ai 生成了一个项目跑一个java agent项目。
然后跑的时候docker compose 报错:
image

这个是错误信息:
failed to solve: eclipse-temurin:11-jre-nanoserver: failed to authorize: failed to fetch oauth token: Post "http
s://auth.docker.io/token": dial tcp 199.59.148.201:443: connectex: A connection attempt failed because the conne
cted party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
docker-compose process finished with exit code 17

docker compose yml

version: '3' services: jadf-demo: build: . container_name: jadf-demo restart: always environment: - JAVA_OPTS=-Xmx256m
dockerfile

# image: eclipse-temurin:11-jre-slim

单独下载镜像是可以下载的:
docker pull eclipse-temurin:11-jre

image

nslookup
image

auth.docker.io
服务器: UnKnown
Address: 192.168.3.1

非权威应答:
名称: auth.docker.io
Addresses: 2a03:2880:f10c:283:face:b00c:0:25de
199.59.148.201

image

解决:

`version: '3'
services:
jadf-demo:
build: .

image: eclipse-temurin:11-jre-slim

container_name: jadf-demo
restart: always
environment:
  - HTTP_PROXY=http://127.0.0.1:PROXY_PORT
  - HTTPS_PROXY=http://127.0.0.1:PROXY_PORT
  - NO_PROXY=localhost,127.0.0.1
  - JAVA_OPTS=-Xmx256m    

`
https://hub.docker.com/_/eclipse-temurin/tags?name=11-jre

posted @ 2025-07-06 00:17  雷学委  阅读(45)  评论(0)    收藏  举报