Connecting to application/node running in a container

There’s an application built with releases and running happily inside a docker container. I try to connect remote shell to it:

docker exec -it <container_hash> bin/myapp remote

and receive:

Erlang/OTP 24 [erts-12.3.2.17] [source] [64-bit] [smp:3:3] [ds:3:3:10] [async-threads:1] [jit]

In order to use --remsh, you need to name the current node using --name or --sname. Aborting...

How do I “name the current node using --name or --sname”?

FWIW - running:

docker exec -it <container_hash> bin/myapp eval 'IO.puts(node())'

returns nonode@nohost

For some reason this is a thing now, if you are using releases, you can set the node name in rel/env.sh.eex here is an example: rel/env.sh.eex · main · SSL MOON / SSL MOON · GitLab

2 Likes

Thank you. That example pointed me to right direction. It was enough to add an envar to the “service” and starting command

Environment=RELEASE_DISTRIBUTION=sname

for things to start working. Thank you once more

3 Likes