$ docker-compose run web rails new . --force --database=mysql
で新規Railsプロジェクトが作成できずにいます。
以下のようにRailsは5.1.6、i18nは1.0.1が入っている状態です。
$ rails -v Rails 5.1.6
$ gem uninstall i18n You have requested to uninstall the gem: i18n-1.0.1 activesupport-5.2.4.1 depends on i18n (< 2, >= 0.7) activesupport-5.1.6 depends on i18n (< 2, >= 0.7) If you remove this gem, these dependencies will not be met. Continue with Uninstall? [yN] N
$ docker-compose run web rails new . --force --database=mysql
を実行します。
$ docker-compose run web rails new . --force --database=mysql Creating network "rails0_default" with the default driver Creating rails0_db_1 ... done exist create README.md create Rakefile create config.ru create .gitignore create Gemfile create app (文字数制限のため一部略) create vendor/assets/javascripts create vendor/assets/javascripts/.keep create vendor/assets/stylesheets create vendor/assets/stylesheets/.keep remove config/initializers/cors.rb run bundle install Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine. The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. Fetching gem metadata from https://rubygems.org/............ Fetching gem metadata from https://rubygems.org/. Resolving dependencies.... Using rake 13.0.1 Using concurrent-ruby 1.1.5 Fetching i18n 1.8.2 Installing i18n 1.8.2 Using minitest 5.14.0 Using thread_safe 0.3.6 Using tzinfo 1.2.6 Fetching activesupport 5.0.7.2 Installing activesupport 5.0.7.2 Using builder 3.2.4 Using erubis 2.7.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.7 Using rails-dom-testing 2.0.3 Using crass 1.0.6 Using loofah 2.4.0 Using rails-html-sanitizer 1.3.0 Fetching actionview 5.0.7.2 Installing actionview 5.0.7.2 Using rack 2.1.2 Using rack-test 0.6.3 Fetching actionpack 5.0.7.2 Installing actionpack 5.0.7.2 Fetching nio4r 2.5.2 Installing nio4r 2.5.2 with native extensions (文字数制限のため一部略) Fetching listen 3.0.8 Installing listen 3.0.8 Fetching mysql2 0.4.10 Installing mysql2 0.4.10 with native extensions Fetching puma 3.12.2 Installing puma 3.12.2 with native extensions Using sprockets 3.7.2 Using sprockets-rails 3.2.1 Fetching rails 5.0.7.2 Installing rails 5.0.7.2 Fetching sass-listen 4.0.0 Installing sass-listen 4.0.0 Fetching sass 3.7.4 Installing sass 3.7.4 Fetching tilt 2.0.10 Installing tilt 2.0.10 Fetching sass-rails 5.0.7 Installing sass-rails 5.0.7 Fetching spring 2.1.0 Installing spring 2.1.0 Fetching spring-watcher-listen 2.0.1 Installing spring-watcher-listen 2.0.1 Fetching turbolinks-source 5.2.0 Installing turbolinks-source 5.2.0 Fetching turbolinks 5.2.1 Installing turbolinks 5.2.1 Fetching uglifier 4.2.0 Installing uglifier 4.2.0 Fetching web-console 3.7.0 Installing web-console 3.7.0 Bundle complete! 15 Gemfile dependencies, 62 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed. Post-install message from i18n: HEADS UP! i18n 1.1 changed fallbacks to exclude default locale. But that may break your application. If you are upgrading your Rails application from an older version of Rails: Please check your Rails app for 'config.i18n.fallbacks = true'. If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be 'config.i18n.fallbacks = [I18n.default_locale]'. If not, fallbacks will be broken in your app by I18n 1.1.x. If you are starting a NEW Rails application, you can ignore this notice. For more info see: https://github.com/svenfuchs/i18n/releases/tag/v1.1.0 Post-install message from sass: Ruby Sass has reached end-of-life and should no longer be used. * If you use Sass as a command-line tool, we recommend using Dart Sass, the new primary implementation: https://sass-lang.com/install * If you use Sass as a plug-in for a Ruby web framework, we recommend using the sassc gem: https://github.com/sass/sassc-ruby#readme * For more details, please refer to the Sass blog: https://sass-lang.com/blog/posts/7828841 run bundle exec spring binstub --all * bin/rake: Spring inserted * bin/rails: Spring inserted
「i18n 1.1でデフォルトロケールを除外するようにフォールバックを変更しました、 I18n (>= 1.1.0) か Rails (< 5.2.2) でこの症状が出る」と表示されます。
実行後にRailsとi18nのバージョンを見ても、i18nは1.0.1でRailsは5.1.6なのでこのエラーは回避できそうな気がします。
しかし以下のようにdbは作成されてますがwebは作成されていません。
$ ls docker-compose.yml Dockerfile Gemfile Gemfile.lock $ docker-compose ps The system cannot find the path specified. Name Command State Ports ----------------------------------------------------------------------- rails0_db_1 docker-entrypoint.sh mysqld Up 3306/tcp, 33060/tcp
これはどのように解決すればいいでしょうか?
参考のためファイルの中身を貼っておきます。
(docker-compose.yml)
version: '3' services: web: build: . command: bundle exec rails s -p 3000 -b '0.0.0.0' volumes: - .:/app ports: - 3000:3000 depends_on: - db tty: true stdin_open: true db: image: mysql:5.7 volumes: - db-volume:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: password volumes: db-volume:
(dockerfile)
FROM ruby:2.4.5 RUN apt-get update -qq && apt-get install -y build-essential nodejs RUN mkdir /app WORKDIR /app COPY Gemfile /app/Gemfile COPY Gemfile.lock /app/Gemfile.lock RUN bundle install COPY . /app ~
(gemfile)
source 'https://rubygems.org' gem 'rails', '5.2.2' gem 'i18n', '1.0.1'
ご検討よろしくお願いいたします。
あなたの回答
tips
プレビュー