# HTTP connection refused errors

**URL:** <https://forum.ansible.com/t/http-connection-refused-errors/27165>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [April 1, 2018, 4:09am UTC](https://forum.ansible.com/t/http-connection-refused-errors/27165 "2018-04-01T04:09:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pranav\_Baitule](https://avatars.discourse-cdn.com/v4/letter/p/3da27b/32.png) [@Pranav\_Baitule](https://forum.ansible.com/u/Pranav_Baitule)\
**Post date:** [April 1, 2018, 4:09am UTC](https://forum.ansible.com/t/http-connection-refused-errors/27165/1 "2018-04-01T04:09:58Z")

</div>

I am running AWX using Docker on a Cent OS 7 host.

I have a playbook that uses the script module to run a python script on the localhost to make HTTP GET requests using the AWX REST API.

But the awx\_task container cannot make connections to complete the request and I get the following error on stdout.  
If I exec into the container and run the playbook, I get this same error -

`

{  
“changed”: false,  
“\_ansible\_verbose\_always”: true,  
“\_ansible\_no\_log”: false,  
“response”: {  
“stdout”: “HTTPConnectionPool(host=‘localhost’, port=80): Max retries exceeded with url: /api/v2/teams/ (Caused by NewConnectionError(‘\<requests.packages.urllib3.connection.HTTPConnection object at 0x18f56d0\>: Failed to establish a new connection: [Errno 111] Connection refused’,))\n”,  
“changed”: true,  
“failed”: false,  
“stderr”: “”,  
“rc”: 0,  
“stdout\_lines”: [  
“HTTPConnectionPool(host=‘localhost’, port=80): Max retries exceeded with url: /api/v2/teams/ (Caused by NewConnectionError(‘\<requests.packages.urllib3.connection.HTTPConnection object at 0x18f56d0\>: Failed to establish a new connection: [Errno 111] Connection refused’,))”  
]  
}  
}

`

These are my proxy settings in the AWX inventory file -

`

# Proxy

# http\_proxy=[http://proxy:3128](http://proxy:3128)

# https\_proxy=[http://proxy:3128](http://proxy:3128)

# no\_proxy=[mycorp.org](http://mycorp.org)

`

I can get out to the internet from the awx\_task container. How can I fix this connection error?

---

<div class="post-metadata">

**Author:** ![Mrinal\_Pande](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@Mrinal\_Pande](https://forum.ansible.com/u/Mrinal_Pande)\
**Post date:** [April 1, 2018, 10:40am UTC](https://forum.ansible.com/t/http-connection-refused-errors/27165/2 "2018-04-01T10:40:50Z")

</div>

Do you have a firewall, I see connection refuse error which can be because of firewall blocking specific port. Or try putting a rule for port in iptables.

---

<div class="post-metadata">

**Author:** ![Pranav\_Baitule](https://avatars.discourse-cdn.com/v4/letter/p/3da27b/32.png) [@Pranav\_Baitule](https://forum.ansible.com/u/Pranav_Baitule)\
**Post date:** [April 2, 2018, 3:06am UTC](https://forum.ansible.com/t/http-connection-refused-errors/27165/3 "2018-04-02T03:06:36Z")

</div>

To clarify, my Cent OS “host” is actually a VM being NATted on a Windows box. I see these chains on Cent OS -

`

Chain DOCKER (1 references)  
target prot opt source destination  
ACCEPT tcp – anywhere 172.17.0.5 tcp dpt:senomix01

Chain DOCKER-ISOLATION (1 references)  
target prot opt source destination  
RETURN all – anywhere anywhere

Chain DOCKER-USER (1 references)  
target prot opt source destination  
RETURN all – anywhere anywhere

`

But since I’m making HTTP requests to localhost, the awx\_task docker container would talk to itself. If I run ‘iptables -L’ i get this -

`

iptables v1.4.21: can’t initialize iptables table `filter’: Permission denied (you must be root)  
Perhaps iptables or your kernel needs to be upgraded.

`

iptables is already on the latest version -  
`  
Package iptables-1.4.21-18.3.el7\_4.x86\_64 already installed and latest version

`

kernel version is -

`  
3.10.0-693.21.1.el7.x86\_64

`
