Please bear in mind, that I'm new to Docker.
I'm using a Mac.
When I followed this official documentation
Run docker compose run --no-deps web rails new . --force --database=postgresql
again, and still get No Rakefile found.
Again, note that if I had followed the link exactly from the beginning, it runs fine.
CodePudding user response:
I really wish that you had been clear about the change that you made to entrypoint.sh
in your original post. I spent a lot of time attempting to answer your original question -- before the edit -- with an answer that was 500 lines long with detailed steps. I could have answered your question in 15 minutes if you had been clear about what changes you made.
But it turns out that the problem is that you're editing entrypoint.sh
and telling it "you should expect to find a Rails app in this directory" before you've created a Rails app in that directory.
These commands are the problem:
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake db:seed
These commands expect:
- There is a bundler-managed Ruby app in this directory
- Its dependencies include the rake gem
- There is an accompanying
Rakefile
in the directory with a configuration that can be understood bybundle exec rake
- There are additional rake tasks defined by the Ruby app in this directory that explain how to execute the commands
db:create db:migrate db:seed
None of that exists until after you create the Rails app.
Follow the instructions in the repository that you linked to first. Don't edit entrypoint.sh
before you've completed those steps because it cannot and will not work the way you expect for the reasons I've described.
CodePudding user response:
FYI: When a Docker container is deleted, the underlying image and any associated data volumes are not removed. This means that when you recreate the same container again, your settings will remain intact. may it help