ruby-on-rails – docker-compose Railsd簧不起作用

ruby-on-rails – docker-compose Railsd簧不起作用,第1张

概述我用 >铁路4.2.5.1运行集装箱 > Ruby 2.3.1运行机智容器 当我开始 $docker-compose exec web /bin/bash # ssh into the web server $bundle exec rails c 我收到以下错误. from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.1/lib/bundl 我用

>铁路4.2.5.1运行集装箱
> Ruby 2.3.1运行机智容器

当我开始

$docker-compose exec web /bin/bash # ssh into the web server $bundle exec rails c

我收到以下错误.

from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.1/lib/bundler/runtime.rb:86:in `each'    from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.1/lib/bundler/runtime.rb:86:in `block in require'    from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.1/lib/bundler/runtime.rb:75:in `each'    from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.1/lib/bundler/runtime.rb:75:in `require'    from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.1/lib/bundler.rb:106:in `require'    from /usr/src/app/config/application.rb:7:in `<top (required)>'    from /usr/local/bundle/gems/spring-1.7.2/lib/spring/application.rb:82:in `require'    from /usr/local/bundle/gems/spring-1.7.2/lib/spring/application.rb:82:in `preload'    from /usr/local/bundle/gems/spring-1.7.2/lib/spring/application.rb:143:in `serve'    from /usr/local/bundle/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'    from /usr/local/bundle/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'    from /usr/local/bundle/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'    from /usr/local/bundle/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'

但是我已经把pq gem放在了Gemfile中.
我已经尝试过了,

$bundle update pg$bundle uninstall pg && bundle install$bundle exec spring binstub --all

但是我没有运气.

我试过的时候

$docker-compose exec web /bin/bash # ssh into the web server$disABLE_SPRING=1 bundle exec rails c

它确实有效.所以我认为spring gem无法正常工作.
此外,如果我在本地做同样的事情,它确实有效.

我认为我的docker_compose.yml设置不正确.
有任何想法吗?

泊坞窗,compose.yml

web:    depends_on:      - 'postgres'      - 'redis'    build: .    command: rails server -b 0.0.0.0    ports:      - '3000:3000'    volumes:      - '.:/usr/src/app'    env_file:      - '.env'  postgres:    image: 'postgres:9.4.4'    environment:      POSTGRES_USER: 'postgres'    ports:      - '5432:5432'  redis:    image: 'redis:3.2-alpine'    command: redis-server    ports:      - '6379:6379'  worker:    depends_on:      - 'postgres'      - 'redis'    build: .    command: bundle exec sIDekiq -C config/sIDekiq.yml.erb     volumes:      - '.:/usr/src/app'    env_file:      - '.env'
解决方法 通过bin / spring调用容器内的app:

$docker-compose exec web bash$bin/spring rails c

运行测试等也是如此:

$bin/spring rspec

单独运行d簧以获得一些额外提示:

$bin/spring

我用Ruby 2.4.3,Rails 5.1.4和Spring 2.0.2测试了这个.

总结

以上是内存溢出为你收集整理的ruby-on-rails – docker-compose Railsd簧不起作用全部内容,希望文章能够帮你解决ruby-on-rails – docker-compose Railsd簧不起作用所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1265055.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-08
下一篇 2022-06-08

发表评论

登录后才能评论

评论列表(0条)

保存