0

I have a docker container that has published port 3001. I can connect to the docker container by pinging it from the host

$ netcat -vzn 0.0.0.0 3001
Connection to 0.0.0.0 3001 port [tcp/*] succeeded!

But from the outside of the host, I get connection refused.

$ netcat -vzn 10.0.0.154 3001
netcat: connect to 10.0.0.154 port 3001 (tcp) failed: Connection refused

The docker container has published ports:

PORTS
0.0.0.0:3001->3001/tcp, :::3001->3001/tcp

The host firewall has been disabled.

The host is a physical server running on Ubuntu.

The containers are not accessible even if running on the hosts network directly...

docker run -it -d -network=host ...

I've read all the documentation, and by every instruction, the containers SHOULD be accessible by hostIp:port with this current set up. I'm not sure if there's anything else I'm missing from Docker instructions, or there's something funky going on with the Ubuntu Server OS itself that is refusing these connections.

Any ideas? Thank you!

1

2 Answers 2

0

I have the exact same problem and I'm not 100% sure but there are still some rules in ubuntu which could block ports called iptables. With nmap localhost you can lookup which ports are open.

0

So I figured out what was going on...

Although the docker ports were actually exposed on the host properly, the application inside the container that is suppose to listen to these ports took longer than I thought to start up. After a while, the application inside the docker container was finally up and the ports were then accessible from outside the host.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .