I created a Docker image and container via docker-compose that consists of a Rails app backed by PostgreSQL. Rails is meant to start via a docker-entrypoint.sh
file which looks like this:
#!/bin/sh
# Exit early if there are any errors.
set -e
# Check that there won't be any server conflicts.
if [ -f tmp/pids/server.pid ]; then
rm tmp/pids/server.pid
fi
# -b binds the server to all IP addresses, rather than to localhost.
bundle exec rails s -b 0.0.0.0
However, the container stops immediately after startup with this error:
bundler: failed to load command: rails (/usr/local/bundle/bin/rails)
LoadError: cannot load such file -- /usr/local/bundle/specifications/exe/rails
/usr/local/bundle/bin/rails:23:in `load'
/usr/local/bundle/bin/rails:23:in `<top (required)>'
Since to my knowledge you can't directly explore the filesystem of a stopped container, I exported the entire filesystem to a .tar
file:
docker export a2410e604db9 > container.tar
Looking inside of container.tar
, I found that there is a /usr/local/bundle/bin/rails
executable file, so I don't know why bundle wouldn't be able to load that command.
The other directory that is mentioned in the error, /usr/local/bundle/specifications/exe/rails
, does not exist. There is only /usr/local/bundle/specifications
, which contains a bunch of .gemspec
files for the Rails project and nothing else.
What is causing this bundler
/LoadError
problem?