How to run rails console on Kamal?

less than 1 minute read

With Kamal 1.x

With Kamal 1.x, you can run the Rails console using the following command:

kamal app exec -i --reuse "bin/rails console"

With Kamal 2.0

With the introduction of aliases in Kamal 2.0 it’s even easier to run the Rails console.

You can define aliases in the deploy.yml file:

aliases:
  console: app exec --reuse -i "bin/rails console"

and then run the Rails console using the following command:

kamal console