Docker Community Forums

Share and learn in the Docker community.

Container not responding? ERR_CONNECTION_REFUSED

I have done 5 chatbots and all are working in my VirtualBox development environment. Now I need to move those chatbots for testing to Azure cloud.

My Azure and VirtualBox environment:
Linux 18.04 server (at virtualBox Ubuntu desktop)
Apache2 2.4.29 (Ubuntu)
Docker version 19.03.13, build 4484c46d9d

Active connections at Azure
(base) paulii@vetbot:~$ sudo netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0* LISTEN 1628/mdsd
tcp 0 0* LISTEN 851/systemd-resolve
tcp 0 0* LISTEN 1153/sshd
tcp6 0 0 :::5005 :::* LISTEN 99061/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 1153/sshd
tcp6 0 0 :::444 :::* LISTEN 68911/apache2

I use webchat as chatbot widget, but when I open web page where chatbot is located http:// aspabotti1. omnia. fi:444 I get error

index.min.js:127 GET http:// localhost:5005/ net::ERR_CONNECTION_REFUSED

Then I tried chatroom as chatbot widget, but now I get following error

Chatroom.js:1197 POST http:// localhost:5005/webhooks/rest/webhook net::ERR_CONNECTION_REFUSED

What I should try next to troubleshoot this?

You need to publish the exposed ports by using the following options:

-P (upper case) or --publish-all that will tell Docker to use random ports from your host and map them to the exposed container’s ports.

-p (lower case) or --publish= that will tell Docker to use ports you manually set and map them to the exposed container’s ports.

The second option is preferred because you already know which ports are mapped. If you use the first option then you will need to call docker inspect demo and check which random ports are being used from your host at the Ports section.

Just run the following command:

docker run -it -p 8080:8080 demo
After that your url will work.

Found reason

thought that when I open container port with this command

-p “5005:5005”

that it opens in local-host but it opened to public internet, so when I changed this

socketUrl: “http://localhost:5005”,

to this

socketUrl: “”,

Chatbot started to work! Isn’t this a security risk?

I can see with command


that container bridge is at

docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet netmask broadcast