Ruby on rails docker compose Rails spring不';行不通
我用Ruby on rails docker compose Rails spring不';行不通,ruby-on-rails,docker,docker-compose,rails-spring,Ruby On Rails,Docker,Docker Compose,Rails Spring,我用 轨道4.2.5.1集装箱内运行 Ruby 2.3.1运行wit容器 当我开始 $ 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/loca
- 轨道4.2.5.1集装箱内运行
- Ruby 2.3.1运行wit容器
$ 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'
然而,我没有得到运气
当我尝试时
$ docker-compose exec web /bin/bash # ssh into the web server
$ DISABLE_SPRING=1 bundle exec rails c
它确实有效。所以我认为SpringGem不能正常工作。
同样,如果我在本地做同样的事情,它也会起作用
我认为我的docker\u compose.yml
设置不正确。
有什么想法吗
docker-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
调用容器内的应用程序:
$ docker-compose exec web bash
$ bin/spring rails c
运行测试等也是如此:
$ bin/spring rspec
单独运行spring获得一些额外提示:
$ bin/spring
我用Ruby 2.4.3、Rails 5.1.4和Spring 2.0.2对此进行了测试。您最终能够解决这个问题吗?
$ bin/spring