Cannot enter pry prompt with dbg or IEx.pry()

You may also want to update a listening address in the config/dev.exs here inside a container to:

http: [ip: {0, 0, 0, 0}, port: 4000]

It will allow you to reach the server from outside the container.

Have tried to reproduce with Podman on Apple Silicon:

  • installed Podman (brew install podman).
  • Prepared a machine (podman machine init).
  • Started a machine (podman machine start).
  • Started the container with podman run --rm -it -p 127.0.0.1:4000:4000 elixir:1.16 bash. I use --rm flag here, so the container will be deleted after I log out. If you want to keep a container - just remove this flag.
  • Git is already installed, cloned the repo.
  • Tried to install the dependencies, but got this error, and applied the fix. It happens on Apple Silicon chips, so it should be fine on Intel-based one.
  • Installed the dependencies via mix deps.get.
  • Installed vim to edit files. You may use nano, if you are not familiar with vim (apt install nano).
  • Edited the config/dev.exs - allowed remote connections (ip: {0, 0, 0, 0} thing from above).
  • Commented Demo.Repo in lib/demo/application.ex (sole link from my previous message).
  • Started the application via iex --dbg pry -S mix phx.server.
  • Visited http://localhost:4000 in browser. Reached the breakpoint.
1 Like