title: docker-compose Rails spring doesn't work
body: <p>I use </p>
  
  <ul>
  <li>Rail 4.2.5.1 running witin container</li>
  <li>Ruby 2.3.1 running wit container</li>
  </ul>
  
  <p>When I start </p>
  
  <pre><code> $ docker-compose exec web /bin/bash # ssh into the web server
   $ bundle exec rails c 
  </code></pre>
  
  <p>I got the following error.</p>
  
  <pre><code>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 `&lt;top (required)&gt;'
      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 `&lt;top (required)&gt;'
      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'
  </code></pre>
  
  <p>However I already put <code>pq</code> gem in Gemfile.
  And I already tried following,</p>
  
  <pre><code>$ bundle update pg
  $ bundle uninstall pg &amp;&amp; bundle install
  $ bundle exec spring binstub --all
  </code></pre>
  
  <p>However I got the no luck.</p>
  
  <p>When I tried,</p>
  
  <pre><code>$ docker-compose exec web /bin/bash # ssh into the web server
  $ DISABLE_SPRING=1 bundle exec rails c
  </code></pre>
  
  <p>It does work. So I think spring gem does not work correctly.
  Also If I do the same thing locally, it does work though.</p>
  
  <p>I think my <code>docker_compose.yml</code> is not set up correctly.
  Any ideas?</p>
  
  <p>docker-compose.yml</p>
  
  <pre><code>  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'
  </code></pre>