travix/gocd-agent-gcloud-packerThis container inherits from travix/gocd-agent-gcloud:latest and adds the following packages
To run this docker container use the following command
shdocker run -d travix/gocd-agent-gcloud-packer:latest
In order to configure the agent for use in your cluster with other than default settings you can pass in the following environment variables
| Name | Description | Default value |
|---|---|---|
| GO_SERVER | The host name or ip address of the server to connect to | localhost |
| GO_SERVER_PORT | The http port of the go server | 8153 |
| AGENT_MEM | The -Xms value for the java vm | 128m |
| AGENT_MAX_MEM | The -Xmx value for the java vm | 256m |
| AGENT_KEY | The secret key set on the server for auto-registration of the agent | |
| AGENT_RESOURCES | The resource tags for the agent in case of auto-registration | |
| AGENT_ENVIRONMENTS | The environments the agent is assigned to in case of auto-registration | |
| AGENT_HOSTNAME | The hostname used for the agent; normally it's the hosts actual hostname | |
| DOCKER_GID_ON_HOST | To mount docker socket and use it without sudo the go user needs to be added to the docker group; pass in the gid from the guest os with this variable |
To connect the agent to your server with other than default ip or hostname
shdocker run -d \ -e "GO_SERVER=gocd.yourdomain.com" \ travix/gocd-agent-gcloud-packer:latest
If you've set up your server for autoregistration of agents pass in the same value for environment variable AGENT_KEY when starting the agent
shdocker run -d \ -e "GO_SERVER=gocd.yourdomain.com" \ -e "AGENT_KEY=***" \ travix/gocd-agent-gcloud-packer:latest
You can also set resource tags, gocd environment and hostname for the agent when autoregistering
shdocker run -d \ -e "GO_SERVER=gocd.yourdomain.com" \ -e "AGENT_KEY=***" \ -e "AGENT_RESOURCES=deploy-x,deploy-z" \ -e "AGENT_ENVIRONMENTS=Production" \ -e "AGENT_HOSTNAME=deploy-agent-01" \ travix/gocd-agent-gcloud-packer:latest
To mount docker socket and be able to use it sudo-less inside the container use the following
shdocker run -d \ -e "GO_SERVER=gocd.yourdomain.com" \ -e "DOCKER_GID_ON_HOST=$(getent group docker | cut -d: -f3)" \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /usr/bin/docker:/usr/bin/docker \ travix/gocd-agent-gcloud-packer:latest
Do be aware that mounting docker inside your container poses a large security risk as the container indirectly has access to the whole machine in this way.
In order to keep working copies over a restart and use ssh keys from the host machine you can mount the following directories
| Directory | Description | Importance |
|---|---|---|
| /var/lib/go-agent/pipelines | This directory holds the working copies for all pipelines that have run on this agent | You want to have this cleaned up regularly anyway, so no real need to mount it |
| /var/log/go-agent | All output logs go here, but there also written to standard out in the container | Preferably collect logs from standard out |
| /var/go/.ssh | The ssh keys to connect to version control systems like github and bitbucket | As it's better not to embed these keys in the container you likely need to mount this |
| /var/go/.gcloud | The google cloud service account key files can be stored here | As it's better not to embed these keys in the container you likely need to mount this |
| /var/run/docker.sock | To mount the docker socket of the guest os | Note: mounting this is a security risk! |
| /usr/bin/docker | To mount the docker binary of the guest os | Note: mounting this is a security risk! |
Start the container like this to mount the directories
shdocker run -d \ -e "GO_SERVER=gocd.yourdomain.com" \ -e "AGENT_KEY=***" \ -e "AGENT_RESOURCES=deploy-x,deploy-z" \ -e "AGENT_ENVIRONMENTS=Production" \ -e "AGENT_HOSTNAME=deploy-agent-01" \ -v /mnt/persistent-disk/gocd-agent/pipelines:/var/lib/go-agent/pipelines -v /mnt/persistent-disk/gocd-agent/logs:/var/log/go-agent -v /mnt/persistent-disk/gocd-agent/ssh:/var/go/.ssh -v /mnt/persistent-disk/gocd-agent/gcloud:/var/go/.gcloud -v /var/run/docker.sock:/var/run/docker.sock \ -v /usr/bin/docker:/usr/bin/docker \ travix/gocd-agent-gcloud-packer:latest
To make sure the process in the container can read and write to those directories create a user and group with same gid and uid on the host machine
shgroupadd -r -g 999 go useradd -r -g go -u 999 go
And then change the owner of the host directories
shchown -R go:go /mnt/persistent-disk/gocd-agent/pipelines chown -R go:go /mnt/persistent-disk/gocd-agent/ssh chown -R go:go /mnt/persistent-disk/gocd-agent/gcloud
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像服务
在 Docker Desktop 配置镜像
Docker Compose 项目配置
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
MacOS OrbStack 容器配置
在宝塔面板一键配置镜像
Synology 群晖 NAS 配置
飞牛 fnOS 系统配置镜像
极空间 NAS 系统配置服务
爱快 iKuai 路由系统配置
绿联 NAS 系统配置镜像
QNAP 威联通 NAS 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
来自真实用户的反馈,见证轩辕镜像的优质服务