Hi Hungry Panda
In your Dockerfile, you can hardcode proxy environment variables at image runtime, like this:
# Base image
FROM ubuntu:22.04
# Set environment variables globally (system-wide)
ENV HTTP_PROXY="http://proxy.company.com:8080"
ENV HTTPS_PROXY="http://proxy.company.com:8080"
ENV NO_PROXY="localhost,127.0.0.1,.company.com"
# Optional: configure APT & wget/curl with proxy
RUN echo 'Acquire::http::Proxy "http://proxy.company.com:8080";' >> /etc/apt/apt.conf.d/01proxy
# Your SDK/tools installation
RUN apt-get update && apt-get install -y \
build-essential \
wget \
curl \
&& rm -rf /var/lib/apt/lists/*
# Optional: for tools like git, npm, etc.
RUN git config --global http.proxy http://proxy.company.com:8080 \
&& npm config set proxy http://proxy.company.com:8080
# Set working directory
WORKDIR /workspace
Here you can use ENV Instructions in Dockerfile, this ensures that any tools inside the container like curl, npm, nuget, etc. respect the proxy settings.
Yes, to test the agent registration and pipeline execution, you’ll need:
- An Azure DevOps organization (you can create one for free)
- A Personal Access Token (PAT) with agent pool permissions
- A self-hosted agent pool created in ADO
You can set up a sample pipeline that uses your Docker image like this:
pool:
vmImage: 'ubuntu-latest'
jobs:
- job: testDocker
container: yourdockerhubusername/your-image-name:latest
steps:
- script: |
echo "Testing tools and proxy..."
echo $HTTP_PROXY
curl -I https://www.google.com
displayName: 'Test inside container'
Hope this helps!
Please Let me know if you have any queries.