From c81aac970cd50f7a3a08ccb4d7790a374efae721 Mon Sep 17 00:00:00 2001 From: csh Date: Mon, 17 Nov 2025 17:52:24 +0800 Subject: [PATCH] =?UTF-8?q?:wrench:=20`docker`=E7=9A=84=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-runner/buildx/docker-compose.yml | 9 +++++---- docker-runner/buildx/register.sh | 2 +- docker-runner/standard/docker-compose.yml | 11 +++++------ docker-runner/standard/register.sh | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docker-runner/buildx/docker-compose.yml b/docker-runner/buildx/docker-compose.yml index 7d6200b..b45e63d 100644 --- a/docker-runner/buildx/docker-compose.yml +++ b/docker-runner/buildx/docker-compose.yml @@ -3,6 +3,7 @@ services: build: . container_name: gitea-runner restart: unless-stopped + network_mode: "host" # 使用宿主机网络 privileged: true volumes: - ./runner-data:/data @@ -17,10 +18,10 @@ services: # 如果需要使用代理,取消下面的注释并修改为你的代理地址 # 注意:容器内访问宿主机需要使用 host.docker.internal 或宿主机IP - - http_proxy=http://host.docker.internal:20122 - - https_proxy=http://host.docker.internal:20122 - - HTTP_PROXY=http://host.docker.internal:20122 - - HTTPS_PROXY=http://host.docker.internal:20122 + # - http_proxy=http://host.docker.internal:20122 + # - https_proxy=http://host.docker.internal:20122 + # - HTTP_PROXY=http://host.docker.internal:20122 + # - HTTPS_PROXY=http://host.docker.internal:20122 # - no_proxy=localhost,127.0.0.1 # Linux 系统需要取消下面的注释以支持 host.docker.internal diff --git a/docker-runner/buildx/register.sh b/docker-runner/buildx/register.sh index 70ccdfb..9bdbada 100644 --- a/docker-runner/buildx/register.sh +++ b/docker-runner/buildx/register.sh @@ -47,7 +47,7 @@ RUNNER_NAME=${RUNNER_NAME:-docker-runner} # 多个 label(逗号分隔,无空格) # ubuntu-22.04:host://ubuntu:22.04,ubuntu-20.04:host://ubuntu:20.04,node:docker://node:18 -read -p "Enter runner labels (default: ubuntu-22.04:docker://ubuntu:22.04): " RUNNER_LABELS +read -p "Enter runner labels (default: ubuntu-22.04:host://ubuntu:22.04): " RUNNER_LABELS RUNNER_LABELS=${RUNNER_LABELS:-ubuntu-22.04:host://ubuntu:22.04} # 创建 runner 目录 diff --git a/docker-runner/standard/docker-compose.yml b/docker-runner/standard/docker-compose.yml index 3532f57..73e42e3 100644 --- a/docker-runner/standard/docker-compose.yml +++ b/docker-runner/standard/docker-compose.yml @@ -3,6 +3,7 @@ services: build: . container_name: gitea-runner restart: unless-stopped + network_mode: "host" # 使用宿主机网络 volumes: - ./runner-data:/data - ./setup.sh:/data/setup.sh:ro @@ -16,15 +17,13 @@ services: # 如果需要使用代理,取消下面的注释并修改为你的代理地址 # 注意:容器内访问宿主机需要使用 host.docker.internal 或宿主机IP - - http_proxy=http://host.docker.internal:20122 - - https_proxy=http://host.docker.internal:20122 - - HTTP_PROXY=http://host.docker.internal:20122 - - HTTPS_PROXY=http://host.docker.internal:20122 + # - http_proxy=http://host.docker.internal:20122 + # - https_proxy=http://host.docker.internal:20122 + # - HTTP_PROXY=http://host.docker.internal:20122 + # - HTTPS_PROXY=http://host.docker.internal:20122 # - no_proxy=localhost,127.0.0.1 # Linux 系统需要取消下面的注释以支持 host.docker.internal # extra_hosts: # - "host.docker.internal:host-gateway" - # 如果需要使用主机网络,取消下面的注释 - # network_mode: host diff --git a/docker-runner/standard/register.sh b/docker-runner/standard/register.sh index 70ccdfb..9bdbada 100644 --- a/docker-runner/standard/register.sh +++ b/docker-runner/standard/register.sh @@ -47,7 +47,7 @@ RUNNER_NAME=${RUNNER_NAME:-docker-runner} # 多个 label(逗号分隔,无空格) # ubuntu-22.04:host://ubuntu:22.04,ubuntu-20.04:host://ubuntu:20.04,node:docker://node:18 -read -p "Enter runner labels (default: ubuntu-22.04:docker://ubuntu:22.04): " RUNNER_LABELS +read -p "Enter runner labels (default: ubuntu-22.04:host://ubuntu:22.04): " RUNNER_LABELS RUNNER_LABELS=${RUNNER_LABELS:-ubuntu-22.04:host://ubuntu:22.04} # 创建 runner 目录