Docker Community Forums

Share and learn in the Docker community.

Two container on same host (A and B). A container can access B, but B can't A

I have two containers on the same host. Both of them are uses bride network.
The host runs under Ubuntu 16.04, the testing host uses 18.04, with enabled UFW.
Container A is a DNS service (dnsmasq), listening on the hosts port 53 (both tcp and udp), host B is a syslog listening on port 514 (udp and tcp too).

Host A can access host B (I see the all log entries on B logs), but B can’ resolve any domain name’s via container A.

I’ve tried it on the live server and on my laptop (on laptop both of then were running localhost and acessed them on that host)

In host’s (both on live system and on my laptop) journal I see, UFW is blocking if one container tries to access the other container’s UDP port 53.
I can solve this problem, with denying docker to make changes in iptables, but…
If it block UDP port 53, why doesn’t is with UPD port 514???
Have you got any idea?

regards,
HZ

Ps: if I try to use this DNS server in container A from an other host (for example my laptop) it works correctly…

I suspect you’ve:

  1. exposed ports on one container but not the other, or
  2. not connected one container to the network.

I also suggest using Docker-Compose to manage multiple containers - it’ll make life easier!

I wrote a Docker for Web Developers book and video course because I couldn’t find good novice tutorials which advised how to create local development environments. Use the discount code dock30 for 30% off.