Remote_console with docker

I’ve read a few tutorials on using docker with elixir and distillery and noticed that they all use bin/<app_name> foreground to start the process.

I wonder if it is possible to use bin/<app_name> start and not have the container shut down when it’s finished. I want to use start since then I can attach to the container and run bin/<app_name> remote_console.

Maybe there is also some way to get into remote console while running foreground?

EDIT:
bin/<app_name> console kind of works but seems hacky.

1 Like

You can use foreground, but when you connect to the container, run /bin/bash or whatever to get a shell, then run bin/myapp remote_console from the root of the release directory. The daemon (i.e. start) is not intended for containers, and won’t work the way you want it to.

4 Likes

If you have a running container you can also do

docker exec -ti $DOCKER_CONTAINER_ID bin/my_app remote_console
6 Likes

For the sake of completeness, to access the console in a remote container over ssh use

ssh -t your-remote-host -C "docker exec -it container-name-or-id /bin/bash path-to-app remote_console"

4 Likes