[erlang-questions] how: Simple distributed Erlang in docker containers
Peter Morgan
peter.james.morgan@REDACTED
Mon May 16 17:30:57 CEST 2016
Hello -
Shell A:
docker run -it --rm erlang bash
root@REDACTED:/# ip addr show dev eth0
794: eth0@REDACTED: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:11:00:07 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.7/16 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::42:acff:fe11:7/64 scope link
valid_lft forever preferred_lft forever
erl -name a@REDACTED -setcookie abc
Erlang/OTP 18 [erts-7.3.1] [source] [64-bit] [smp:6:6] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V7.3.1 (abort with ^G)
(a@REDACTED)1>
Shell B:
docker run -it --rm erlang bash
796: eth0@REDACTED: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:11:00:08 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.8/16 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::42:acff:fe11:8/64 scope link
valid_lft forever preferred_lft forever
erl -name b@REDACTED -setcookie abc
Erlang/OTP 18 [erts-7.3.1] [source] [64-bit] [smp:6:6] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V7.3.1 (abort with ^G)
(b@REDACTED)1> net_adm:ping('a@REDACTED').
pong
(b@REDACTED)2>
Take a look at the "--add-host=“ parameter to docker run, rather than modifying /etc/hosts.
Thanks
Peter.
> On 16 May 2016, at 13:58, Bengt Kleberg <bengt.kleberg@REDACTED> wrote:
>
> Greetings,
>
> What is needed to get two Erlang nodes talking if they are in Docker containers (on the same machine)?
> net_kernel:connect/1 fails.
>
>
> I have started 2 Docker containers (kalle and gustav) and it is possible to do
> ping kalle
> PING kalle.asd.se (172.17.0.4) 56(84) bytes of data.
> 64 bytes from kalle.asd.se (172.17.0.4): icmp_seq=1 ttl=64 time=0.137 ms
>
> and
> ping gustav
> PING gustav.asd.se (172.17.0.5) 56(84) bytes of data.
> 64 bytes from gustav.asd.se (172.17.0.5): icmp_seq=1 ttl=64 time=0.147 ms
>
>
> Starting Erlang like this:
> erl -sname n -setcookie asd
> Erlang/OTP 17 [erts-6.3] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
>
> Eshell V6.3 (abort with ^G)
> (n@REDACTED)1> net_kernel:connect('n@REDACTED').
> false
>
> and, from the other side:
> erl -sname n -setcookie asd
> Erlang/OTP 17 [erts-6.3] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
>
> Eshell V6.3 (abort with ^G)
> (n@REDACTED)1> net_kernel:connect('n@REDACTED').
> false
>
>
> bengt
> (*) I manually added them to their respective /etc/hosts. If there is a way to do it automatically I would like to know.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list