[erlang-questions] Can't connect to Erlang node in docker

Roger Lipscombe roger@REDACTED
Wed Jun 5 15:22:51 CEST 2019

On Wed, 5 Jun 2019 at 13:28, Juan Jose Comellas <juanjo@REDACTED> wrote:
> This is most probably not a problem with Erlang but missing configuration settings in Docker. Have you published or exposed the ports outside of the Docker container [1]? Are you starting the containers individually or are you using docker-compose or something like that?

Using docker-compose. The ports are not forwarded to localhost,
because I've got a whole bunch of Erlang nodes in docker containers,
and that approach won't scale.

> I would recommend reading up on the different options that Docker provides for networking.

Docker networking is fine; using the IP address of the container (or
DNS name; I've got dnsmasq forwarding a domain suffix), I can telnet
to the epmd port and to the distribution port (and to various HTTP
ports, etc.). It's Erlang's node discovery/connection process that's
not working. erl_epmd:names works fine if I run it on the host, and
specify one of the containers.

So I'm guessing that Erlang doesn't like the lashed-up DNS resolution,
or something, but it won't connect using the IP address in the node
name either.

As I pointed out, if I connect from a node in the container to a node
on the host, it works fine, which also implies that it's not a
networking problem, per se. But rather it's a discovery/resolution
problem. But I don't understand how that actually works in OTP, so...

> If you send some sample Dockerfile or docker-compose.yml file with the arguments you're using to start the nodes, we could provide better feedback.

The nodes are using relx-generated startup scripts, identical to the
ones we're using in production (where they're not running in
containers). We start them using s6-overlay.

More information about the erlang-questions mailing list