Fly ssh console no longer has dependencies installed

Until yesterday, when I were to run

fly ssh console

I would be connected to my deployed image at the / path. If I were to cd app into my directory, I could run scripts using bundle exec rake ...

Starting yesterday, the path that I am connected to changes to /app which is fine, but neither bundle nor rake nor even ruby are available.

root@2178119d3c0896:/app# bundle
-bash: bundle: command not found

root@2178119d3c0896:/app# rake
-bash: rake: command not found

root@2178119d3c0896:/app# ruby
-bash: ruby: command not found

root@2178119d3c0896:/app# echo $PATH

Was there some change to the ssh subsystem? How can I get access to my dependencies?

Hi @idbentlye—you’re right, there were some changes to SSH recently to try to improve the user experience. One of the changes is to launch a login shell based on the shell configured in the image’s /etc/passwd by default—bash in your case.

Since your app is located in /app, I’m guessing that you’re using an older Dockerfile based on the fullstaq-ruby base image (see here for more details). The Ruby binaries in that image are located in a non-standard directory (e.g. /usr/lib/fullstaq-ruby/versions/3.1.2-jemalloc/bin/ruby). The Docker image sets the PATH to find them, but bash will apparently overwrite it when run as a login shell. I’m wondering if that’s what’s happening to you.

(Interestingly, it looks like the fullstaq-ruby image recently added a workaround for this, but not all the tags they provide have it.)

For now, my guess is that specifying the shell command manually like this will work:

fly ssh console --pty -C /bin/bash

This should avoid starting bash as a login shell, so it won’t reset the PATH.

In any case, thanks for reporting this!

1 Like

Thank you!

It seems that you are right, and using that alternative invocation, I am able to access dependencies!

With regards to a better solution, would you recommend I update my docker image to use a newer ruby docker base? Looking at the rails docker generator, it seems to be using:$RUBY_VERSION-slim. If I update my Dockerfile, it won’t use the non-standard directory, and I should be able to connect as before?


Assuming your code is committed to git, you can give GitHub - fly-apps/dockerfile-rails: Provides a Rails generator to produce Dockerfiles and related files. a try. It will replace your Dockerfile with one that closely matches the one that Rails 7.1 will be using. It also is the same Dockerfile that a newly launched Rails applications will be provided with. If this works, you can commit it. If you have problems, feel free to come back here and we’ll see if we can get you working with the latest Dockerfile.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.