IEx inside a docker

I’m running my Phoenix in production inside a docker everything works perfectly.
I would like to be able to open my server into iex console.
So when I run iex --sname prod01@172.31.56.165

and I got this error:

2017-08-06 01:37:38 Can't set short node name!
Please check your configuration

2017-08-06 01:37:38 crash_report        
    initial_call: {net_kernel,init,['Argument__1']}
    pid: <0.48.0>
    registered_name: []
    error_info: {exit,{error,badarg},[{gen_server,init_it,6,[{file,"gen_server.erl"},{line,344}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
    ancestors: [net_sup,kernel_sup,<0.35.0>]
    messages: []
    links: [<0.45.0>]
    dictionary: [{longnames,false}]
    trap_exit: true
    status: running
    heap_size: 610
    stack_size: 27
    reductions: 180
2017-08-06 01:37:38 supervisor_report   
    supervisor: {local,net_sup}
    errorContext: start_error
    reason: {'EXIT',nodistribution}
    offender: [{pid,undefined},{id,net_kernel},{mfargs,{net_kernel,start_link,[['prod01@172.31.56.165',shortnames],true]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]
2017-08-06 01:37:38 supervisor_report   
    supervisor: {local,kernel_sup}
    errorContext: start_error
    reason: {shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}
    offender: [{pid,undefined},{id,net_sup},{mfargs,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]
2017-08-06 01:37:38 crash_report        
    initial_call: {application_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}
    pid: <0.34.0>
    registered_name: []
    error_info: {exit,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,134}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
    ancestors: [<0.33.0>]
    messages: [{'EXIT',<0.35.0>,normal}]
    links: [<0.33.0>,<0.32.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 376
    stack_size: 27
    reductions: 153
2017-08-06 01:37:38 std_info            
    application: kernel
    exited: {{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}}
    type: permanent
{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{ker

Crash dump is being written to: erl_crash.dump...done

Do you know why I have this error?

1 Like

This is a full node name, not a short node name. A short node name would be like prod01, a full node name is like prod01@172.31.56.165. Short node names are only really accessible (short tunnelling and such) on the local machine. You probably want to use a long node name, I.E. don’t use --sname, but rather --name if I recall correctly. :slight_smile:

Thanks for your answer but unfortunately that do not work :frowning:

iex --name prod01@172.31.56.165 Protocol 'inet_tcp': the name prod01@172.31.56.165 seems to be in use by another Erlang node

To show I set the right name here my conf:
epmd -names epmd: up and running on port 4369 with data: name prod01 at port 9100

Precisely that then, you have a duplicate name created. :slight_smile:

The solution I had it to call from the server 1 the server 2 and server 2 the server 1. Thanks it works