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.
-bash: bundle: command not found
-bash: rake: command not found
-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.
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: registry.docker.com/library/ruby:$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?