Sign inSign up

spidocker4/vstsagent

By spidocker4

β€’Updated over 1 year ago

ADO agent - Azure Devops CICD agent

Image
Security
Integration & delivery
Monitoring & observability
0

156

spidocker4/vstsagent repository overview

⁠Custom Azure DevOps Agent Docker Image

This Docker image provides a pre-configured Azure DevOps agent (VSTS agent) based on Ubuntu Jammy (22.04), tailored for environments behind a proxy and with retry logic for agent configuration.


⁠🐳 Image Overview

  • Base Image: ubuntu:jammy-20250619
  • Azure DevOps Agent Version: 4.258.1
  • Features:
    • Supports running behind HTTP/HTTPS proxy
    • Configurable via environment variables
    • Retries configuration on failure
    • Graceful shutdown and cleanup
    • Runs Azure CLI out-of-the-box

β πŸ“ File Structure

/
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ script.sh           # Main entrypoint for agent setup and execution
└── README.md           # You're here!

β βš™οΈ Build the Image

docker build -t custom-ado-agent:latest .

β πŸš€ Run the Container

docker run -d   --name ado-agent   -e AZURE_DEVOPS_ORG_URL="https://dev.azure.com/<your-org>"   -e AZURE_DEVOPS_PROJECT_NAME="<your-project>"   -e AZURE_DEVOPS_POOL_NAME="SelfHosted"   -e AZURE_DEVOPS_POOL_AGENT_NAME="ado-agent"   -e http_proxy="http://proxy-host:port"   -e https_proxy="http://proxy-host:port"   -e http_proxy_user="your-username"   -e http_proxy_pass="your-password"   -v /path/to/token:/etc/AZURE_DEVOPS_PAT_TOKEN:ro   custom-ado-agent:latest

πŸ’‘ Make sure the file /path/to/token contains your Azure DevOps PAT (Personal Access Token) with agent management permissions.


⁠🌐 Environment Variables

Variable NameRequiredDescription
AZURE_DEVOPS_ORG_URLβœ…Azure DevOps organization URL
AZURE_DEVOPS_PROJECT_NAMEβœ…Azure DevOps project name
AZURE_DEVOPS_POOL_NAMEβœ…Agent pool name
AZURE_DEVOPS_POOL_AGENT_NAMEβœ…Logical name of the agent
http_proxy, https_proxy❌Proxy settings (optional)
http_proxy_user❌Username for proxy (if authentication required)
http_proxy_pass❌Password for proxy (required if http_proxy_user is set)

β πŸ“„ Logs

Logs are written to:

/home/vstsagent/vsts-agent.log

You can access them using:

docker exec -it ado-agent tail -f /home/vstsagent/vsts-agent.log

β πŸ”„ Graceful Shutdown

On container termination (SIGTERM, SIGINT, EXIT), the agent automatically:

  • Deregisters itself from Azure DevOps
  • Cleans up configuration
  • Retries config.sh remove if needed

β πŸ›  Debugging Tips

  • To enter the container interactively:
docker exec -it ado-agent /bin/bash
  • Check the agent configuration status:
cat /home/vstsagent/vsts-agent.log

β πŸ“¦ What’s Included

  • Azure CLI (via https://aka.ms/InstallAzureCLIDeb)
  • Git
  • JQ & curl
  • VSTS agent binaries (vsts-agent-linux-x64-4.258.1.tar.gz)

⁠🧼 Cleanup

To stop and remove the agent:

docker stop ado-agent && docker rm ado-agent

To remove the image:

docker rmi custom-ado-agent:latest

β πŸ“ Disclamer

This image is provided as-is without any official support from Microsoft. Use at your own discretion.


⁠🧰 Custom Azure DevOps Agent (Self-Hosted)

This image provides a self-hosted Azure DevOps Agent (formerly VSTS) built on Ubuntu Jammy, preconfigured with support for:

βœ… Proxy authentication
βœ… Azure CLI
βœ… Retry + graceful cleanup logic
βœ… Lightweight footprint with Git and required system tools


β πŸ“¦ Image Contents

  • Azure DevOps Agent: vsts-agent-linux-x64-4.258.1
  • Azure CLI (via Microsoft installer)
  • Git, curl, jq, unzip, libicu

β πŸš€ How to Use

docker run -d   --name ado-agent   -e AZURE_DEVOPS_ORG_URL="https://dev.azure.com/<your-org>"   -e AZURE_DEVOPS_PROJECT_NAME="<your-project>"   -e AZURE_DEVOPS_POOL_NAME="SelfHosted"   -e AZURE_DEVOPS_POOL_AGENT_NAME="ado-agent"   -v /path/to/token:/etc/AZURE_DEVOPS_PAT_TOKEN:ro   <your-image-name>:<tag>

ℹ️ For proxy support, pass http_proxy, https_proxy, http_proxy_user, and http_proxy_pass environment variables.


⁠🧼 Cleanup

The agent gracefully deregisters on container shutdown via trap handling.


β πŸ›  Source

This image is automatically built via GitHub autobuild from the Dockerfile and entrypoint script in the linked repository.

Tag summary

Content type

Image

Digest

sha256:07f4c3834…

Size

556.6 MB

Last updated

over 1 year ago

docker pull spidocker4/vstsagent:mcr-jdk-20250705