Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Centos VM with Docker getting host unreachable when trying to connect to itself

I have Docker running on a Centos VM, with bridged network. running

ifconfig

shows that my VM gets a valid IP address. Now I'm running some software within a docker container/image (which works within other docker/networking configurations). Some of my code running in the docker container uses SSL Connection (java) to connect to itself. In all other run configurations, this works perfectly. But when running in bridged mode with Centos VM and docker-compose, I'm getting an SSL Connect exception, error: Host unreachable. I can ping to and ssh into the VM with the same IP address and this all works fine. I'm sorry that I can't post actual setup/code and scripts as it's too much to post and it's also proprietary.

I'm baffled by this - why am I getting Host Unreachable in the aforementioned configuration?

like image 692
Nena Avatar asked Aug 24 '16 23:08

Nena


Video Answer


1 Answers

FYI, I resolved the problem on centos by using the default "bridged" containers provided by Docker, but adding the following to my firewalld configuration:

firewall-cmd --permanent --zone=trusted --add-interface=docker0
firewall-cmd --reload
service firewalld restart

You might also need to open up a port to allow external communication, like so:

firewall-cmd --zone=public --add-port=8080/tcp --permanent
like image 118
Nena Avatar answered Sep 20 '22 14:09

Nena