Bobcares Logo
Search Call 1-800-383-5193 Emergency Contact
Bobcares Logo
Search Call 1-800-383-5193 Emergency Contact
Emergency Contact

Set up HTTP proxy for Docker and ECS container agent: Amazon EC2

by Jiji Jose | Aug 18, 2021 | Amazon Web Services (AWS), Docker, Latest | 0 comments

Wondering how to set up an HTTP proxy for Docker and ECS container agent? We can help you with this!

Here, at Bobcares, we often receive similar requests from our AWS customers as a part of our AWS Support Services.

Today, let’s see the steps followed by our Support Techs to help our customers to set up an HTTP proxy for Docker and ECS container agents.
 

Set up an HTTP proxy for Docker and ECS container agent

 
Let’s see the steps to set up an HTTP proxy for Docker and ECS container agents in Amazon Linux:

  1. At first, we have to store the IP address and proxy server port.
  2. Then, we need to set up an HTTP proxy for the Docker.
  3. The next step is to set up an HTTP proxy for the Amazon ECS container agent to connect to the internet.
  4. And finally, we need to set up an HTTP proxy for ecs-init

 

Storing the IP address and proxy server port

 

  1. Firstly, access the EC2 instance via SSH.

2. Switch to root user and then store the IP address and port of the proxy server. For example, see the following:

# export PROXY_SERVER_IP=x.x.x.x
# export PROXY_PORT=9876

 

Set up an HTTP proxy for the Docker

 

  1. To set up the HTTP proxy for the Docker daemon, run the following command:
# cat <<EOF >> /etc/sysconfig/docker
>export HTTP_PROXY=http://$PROXY_SERVER_IP:$PROXY_PORT
>export HTTPS_PROXY=https://$PROXY_SERVER_IP:$PROXY_PORT
>export NO_PROXY=169.254.169.254,169.254.170.2
>EOF

Here, HTTP_PROXY is the socket address of the HTTP proxy that’s used to connect the Amazon ECS container agent to the internet. Also, we must set the NO_PROXY variable to 169.254.169.254,169.254.170.2, and this setting filters EC2 instance metadata, AWS Identity, and Access Management (IAM) roles for tasks, and Docker daemon traffic from the proxy.

2. Restart Docker and while restarting the docker using the following command will stop all running containers including the ecs-agent on the container instance.

# service docker restart

3. Run the following command to verify HTTP proxy settings for Docker daemon.

# docker info | grep -i proxy
HTTP proxy:  http://x.x.x.x:9876
HTTPS proxy:  http://x.x.x.x:9876
NO proxy:  169.254.169.254,169.254.170.2

 

Set up an HTTP proxy for the Amazon ECS container agent to connect to the internet

 

  1. Now include the proxy configuration using the HTTP_PROXY and NO_PROXY agent configuration parameters in the ECS configuration file, /etc/ecs/ecs.config.
#cat <<EOF >> /etc/ecs/ecs.config
>ECS_CLUSTER=cluster-name
>HTTP_PROXY=http://$PROXY_SERVER_IP:$PROXY_PORT
>NO_PROXY=169.254.169.254,169.254.170.2,/var/run/docker.sock
>EOF

2. Then start the ECS agent to apply the proxy configuration to the agent .

# sudo start ecs

By default, the Amazon ECS container agent runs through ecs-init if we are using an Amazon ECS-optimized AMI.

3. We can run the following command to verify the HTTP proxy settings for Docker and the ECS agent.

# docker inspect ecs-agent | grep -i proxy
"HTTP_PROXY=http://x.x.x.x:9876",
"NO_PROXY=169.254.169.254,169.254.170.2,/var/run/docker.sock"

 

Set up an HTTP proxy for ecs-init

 
The last step is to set the HTTP proxy for ecs-init communication. Run the following command:

# cat <<EOF > /etc/init/ecs.override
>env HTTP_PROXY=$PROXY_SERVER_IP:$PROXY_PORT
>env NO_PROXY=169.254.169.254,169.254.170.2,/var/run/docker.sock
>EOF

This configuration of the Amazon ECS container agent and the Docker daemon affects all the currently running instances.

Also, note that we can also set the environment variables while launching by using Amazon EC2 user data with a user data script.

[Need help with more AWS queries? We’d be happy to assist]
 

Conclusion

 
To conclude, today we discussed the steps followed by our Support Engineers to help our customers to set up an HTTP proxy for Docker and ECS container agents.

Submit a Comment Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • A 15-Minute Self-Hosted RAG Stack Tutorial: From Zero to Production
  • Designing Data Pipelines That Prevent Outages Across Global Systems
  • Deployment Automation: Deploy With Efficiency and Consistency
  • What Is Proactive Monitoring? A Complete Guide
  • AI Use Cases: How Artificial Intelligence Is Used Across Industries

Categories

  • Advanced Vulnerability
  • AI Services
  • AI Support
  • AIOps
  • Amazon Web Services (AWS)
  • Apache
  • API Integration
  • Application Development
  • Azure
  • Cloud Cost Optimization
  • Cloud Management
  • Cloud-Native Application
  • Cloudflare
  • cPanel
  • cPanel migration
  • Cyberpanel
  • DDoS
  • Development Service
  • DevOps
  • DevOps Consulting
  • DevSecOps
  • Digital Transformation
  • DigitalOcean
  • DirectAdmin
  • Docker
  • Drupal
  • Ecommerce
  • Filezilla
  • FTP
  • Google cloud platform
  • HAProxy
  • Headless CMS Integration
  • Hosting Support
  • IIS
  • Infrastructure Management & Optimization
  • Kubernetes
  • KVM
  • Laravel
  • Latest
  • Linode
  • Litespeed
  • LXC/LXD
  • Magento
  • Mobile App Development
  • MongoDB
  • Moodle
  • MySQL
  • NFS
  • Nginx
  • OnApp
  • Outsourced Support
  • OVH
  • ovirt
  • pfsense
  • Plesk
  • PostgreSQL
  • PowerDNS
  • Product Engineering
  • Proxmox
  • RedHat
  • Redis
  • Sendmail
  • Server Administration
  • Server Management
  • Software Development
  • SQLServer
  • Technical Support
  • UI/UX
  • Virtualizor
  • VMware
  • VPN
  • Vulnerability Scanning
  • Vultr
  • Web Development
  • Windows
  • WordPress
  • WordPress Hosting
  • WordPressHA

Subscribe to our newsletter

Footer newsletter

Email sales@bobcares.com | Phone 1-800-383-5193

Product Engineering

  • MVP Build
  • MVP to Scale
  • Product Maintenance

Digital Transformation

  • Process Digitization & Automation
  • Systems Integration & Workflow Orchestration
  • Data Enablement & Decision Support
  • Application & Platform Modernization
  • Transformation Execution & Delivery Enablement

AI Services

  • AI Readiness & Use-Case Discovery
  • AI Integration & Application Enablement
  • Intelligent Automation & AI Workflows

Infrastructure Management

  • Always-On Infrastructure Management
  • Proactive Monitoring & Incident Prevention
  • Cloud Cost Control & Optimization (FinOps)
  • Outsourced IT & End-User Support
  • Managed Infrastructure Execution Support

DevOps & Automation Services

  • CI/CD & Release Automation
  • Infrastructure as Code & Platform Standardization
  • Reliability Engineering & Observability
  • DevSecOps Enablement
Product Engineering +
Web Development MVP to Scale Builds Microservices Architecture Agile & Dev Team Augmentation Mobile Apps Ecommerce UI/UX Design QA & Test Automation
Digital Transformation +
Legacy Modernization Workflow Automation Data-Driven Dashboards CRM / ERP Integration Business Process Re-engineering
AI Services +
AI & Machine Learning AIOps Intelligent Automation Business Intelligence & Analytics AI Installation & Compute
Infrastructure Management +
Cloud Setup Cloud Migration Managed Cloud Services Server & Hosting Cost Optimization Performance Optimization Outsourced Support
DevOps & Automation Services +
CI/CD Setup Kubernetes & Docker Infrastructure as Code Cloud-Native Migration DevSecOps
Cybersecurity & Compliance Services +
Security Hardening VAPT Incident Response Backup & DR

© 2026 Bobcares. All Rights Reserved.

  • Careers
  • |
  • Cookie Policy
  • |
  • GDPR
  • |
  • Privacy Policy
  • |
  • Terms and Service
  • LinkedIn
  • YouTube
  • Instagram
  • Facebook

Preview of the new Bobcares experience
NEW UPDATE
See What’s New
at Bobcares

Discover a faster, clearer view of our services and expertise.


Explore the New Experience
Arrow Right