[英]Docker compose has no internet access
Docker compose 構建失敗。 拉取圖像沒有問題,但在嘗試運行“RUN pip install pipenv”等命令時由於超時而失敗。 只有將 .network: host" 添加到 docker-compose.yml 中才能構建。無論如何,它不能解決我的問題,因為任何發送 GET 請求的嘗試都會因超時而失敗。不知道該怎么做。同樣的問題發生在 Ubuntu 22 和 Manjaro 21.
構建錯誤:
=> [6/9] RUN pip install --upgrade pip 85.7s
=> => # Requirement already satisfied: pip in /usr/local/lib/python3.9/site-packages (22.0.4)
=> => # WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HT
=> => # TPSConnection object at 0x7f3f75f13340>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/pip/
請求錯誤:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='google.com', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fccaa7afdc0>: Failed to establish a new connection: [Errno 110] Connection timed out'))
您可以使用已定義的 su.net 創建一個 custom.network:
version: '3'
services:
web:
build:
context: .
network: custom_network
networks:
custom_network:
ipam:
driver: default
config:
- subnet: "192.168.100.1/28"
試試這個,我希望這會有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.