基于Wolfi的GoCD服务器容器镜像。
请通过 https://github.com/gocd/gocd 提交。
通过以下命令启动容器:
shelldocker run -d -p8153:8153 gocd/gocd-server:v25.3.0
此命令会将容器的8153端口(HTTP)暴露到主机。启动后可通过 http://localhost:8153 访问。
GoCD服务器会将所有配置、流水线历史数据库、制品、插件和日志存储在 /godata 目录。如需提供SSH私钥等安全凭证,可挂载 /home/go 目录:
shelldocker run -v /path/to/godata:/godata -v /path/to/home-dir:/home/go gocd/gocd-server:v25.3.0
注意: 确保
/path/to/home-dir和/path/to/godata可被容器内的go用户(uid1000)访问。
所有插件可安装在 /godata 目录下。
使用环境变量安装插件
通过添加前缀为 GOCD_PLUGIN_INSTALL_、后缀为自定义名称的环境变量,值为插件下载URL,即可安装插件。插件仅在不存在时下载。
例如,安装Docker弹性代理插件:GOCD_PLUGIN_INSTALL_docker-elastic-agents=https://github.com/gocd-contrib/docker-elastic-agents/releases/download/v0.8.0/docker-elastic-agents-0.8.0.jar:
shelldocker run \ -e GOCD_PLUGIN_INSTALL_docker-elastic-agents=https://github.com/gocd-contrib/docker-elastic-agents/releases/download/v0.8.0/docker-elastic-agents-0.8.0.jar \ gocd/gocd-server:v25.3.0
安装多个插件可添加多个 -e 参数:
shelldocker run \ -e GOCD_PLUGIN_INSTALL_a-plugin=https://example.com/a-plugin.jar \ -e GOCD_PLUGIN_INSTALL_b-plugin=https://example.com/b-plugin.jar \ gocd/gocd-server:v25.3.0
使用自定义入口脚本安装插件(见下文)
shellmkdir -p /godata/plugins/external curl --location --fail https://example.com/plugin.jar > /path/to/godata/plugins/external/plugin.jar chown -R 1000 /godata/plugins/external
通过环境变量 CONFIG_GIT_REPO 加载配置。私有仓库可使用认证令牌。默认克隆 master 分支,如需指定分支,可通过 CONFIG_GIT_BRANCH 环境变量设置。若 /godata/config 已为Git仓库,则 CONFIG_GIT_REPO 会被忽略。克隆的仓库必须包含 /godata/config 目录的所有文件。
shelldocker run \ -e CONFIG_GIT_REPO=https://gocd_user:<password_or_auth_token>/config.git \ -e CONFIG_GIT_BRANCH=branch_with_config \ gocd/gocd-server:v25.3.0
检出的内容会覆盖 /godata/config/ 中的文件。
如需在容器启动阶段、GoCD服务器启动前执行自定义脚本,可通过 -v /path/to/your/script.sh:/docker-entrypoint.d/your-script.sh 挂载脚本:
shelldocker run -v /path/to/your/script.sh:/docker-entrypoint.d/your-script.sh ... gocd/gocd-server:v25.3.0
若需执行多个脚本,可挂载包含脚本的目录:
shelldocker run -v /path/to/script-dir:/docker-entrypoint.d ... gocd/gocd-server:v25.3.0
注意: 确保脚本具有可执行权限(
chmod a+x),容器中已安装bash。若使用其他脚本语言(如perl、python),需确保容器中已安装相应解释器。
可通过环境变量 GOCD_SERVER_JVM_OPTS 调整JVM选项:
shelldocker run -e GOCD_SERVER_JVM_OPTS="-Xmx4096mb -Dfoo=bar" gocd/gocd-server:v25.3.0
GoCD服务器以 go 用户(uid 1000)运行,以下是主要目录说明:
| 目录路径 | 描述 |
|---|---|
/godata/artifacts | GoCD制品存储目录 |
/godata/config | GoCD配置存储目录 |
/godata/db | GoCD数据库及配置变更历史存储目录 |
/godata/logs | GoCD日志输出目录 |
/godata/plugins | GoCD插件目录 |
/home/go | GoCD服务器的主目录 |
GoCD服务器启动后,需确定其在容器中的IP地址及映射到主机的端口,供GoCD代理连接使用。若通过以下命令启动容器:
shelldocker run --name server -it -p8153:8153 gocd/gocd-server:v25.3.0
可通过以下命令获取服务器IP、服务器端口和SSL端口:
shelldocker inspect --format='{{(index (index .NetworkSettings.IPAddress))}}' server docker inspect --format='{{(index (index .NetworkSettings.Ports "8153/tcp") 0).HostPort}}' server
docker ps -adocker logs CONTAINER_IDdocker exec -it CONTAINER_ID tail -f /godata/logs/go-server.log(若使用卷挂载,可直接查看挂载目录中的日志文件)plainCopyright Thoughtworks, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at [***] Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务