title: Rails can't find rake gem for docker app
body: <p>I have a Rails application running in docker. I have two images which are connected. I can't run server of one of them and it works fine, but I cannot run another one and none of simple commands doesn't work too. It fails telling me Could not find rake-12.3.1 in any of the sources.</p>
  
  <p><a href="https://stackoverflow.com/questions/49598686/rails-cant-find-rake-gem">There is already existing solution</a></p>
  
  <p>None of the solutions from link above doesn't work.</p>
  
  <h2>Error looks  like this</h2>
  
  <pre><code>bundler: failed to load command: puma (/usr/local/bundle/bin/puma)
  Bundler::GemNotFound: Could not find rake-12.3.1 in any of the sources
  </code></pre>
  
  <h2>Here is my Gemfile:</h2>
  
  <pre><code>source 'https://rubygems.org'
  gem 'rails', '~&gt; 4.2'
  gem 'rails-i18n'
  gem 'responders', '~&gt; 2.0'
  gem 'puma'  
  gem 'mysql2', '~&gt; 0.3.21'
  gem 'redis-rails'
  
  gem 'json'
  gem 'jbuilder'
  
  gem 'omniauth',               '~&gt; 1.8.1'
  gem 'omniauth-auth0',         '~&gt; 2.0.0'  
  gem 'omniauth-google-oauth2', '~&gt; 0.5.2'
  gem 'omniauth-barong',        '~&gt; 0.1.2'
  
  gem 'figaro'
  gem 'hashie', '~&gt; 3.0'
  
  gem 'aasm', '~&gt; 4.12'
  gem 'bunny', '~&gt; 2.9.0'
  gem 'cancancan'
  gem 'enumerize'
  gem 'datagrid'
  gem 'kaminari'
  gem 'paranoid2'
  gem 'active_hash'
  gem 'http_accept_language'
  gem 'paper_trail', '~&gt; 3.0.1'
  gem 'rails-observers'
  gem 'country_select', '~&gt; 2.1.0'
  
  gem 'gon', '~&gt; 5.2.0'
  gem 'pusher'
  gem 'eventmachine', '~&gt; 1.0.4'
  gem 'em-websocket', '~&gt; 0.5.1'
  
  gem 'simple_form', '~&gt; 3.1.0'
  gem 'slim-rails'
  gem 'sass-rails'
  gem 'coffee-rails'
  gem 'uglifier', '~&gt; 4.1'
  gem 'jquery-rails'
  gem 'angularjs-rails', '~&gt; 1.3.15'
  gem 'bootstrap-sass', '~&gt; 3.2.0.2'
  gem 'font-awesome-sass'
  gem 'bourbon'
  gem 'momentjs-rails'
  gem 'eco'
  gem 'browser', '~&gt; 0.8.0' 
  gem 'rbtree'
  gem 'liability-proof', '0.0.9'
  gem 'grape', '~&gt; 1.0.1' 
  gem 'grape-entity', '~&gt; 0.5.2'
  gem 'grape-swagger', '~&gt; 0.27.3'
  gem 'grape-swagger-ui', '~&gt; 2.2.8'
  gem 'rack-attack', '~&gt; 4.3.1'
  gem 'easy_table'
  gem 'faraday', '~&gt; 0.12'
  gem 'jwt', '~&gt; 1.5'
  gem 'email_validator', '~&gt; 1.6'
  gem 'clipboard-rails', '~&gt; 1.7'
  gem 'god', '~&gt; 0.13.7', require: false
  gem 'mini_racer', '~&gt; 0.1', require: false
  gem 'arel-is-blank', '~&gt; 1.0' 
  gem 'sentry-raven', '~&gt; 2.7', require: false
  gem 'memoist', '~&gt; 0.16'
  gem 'method-not-implemented', '~&gt; 1.0'
  gem 'passgen', '~&gt; 1.0'
  gem 'validates_lengths_from_database', '~&gt; 0.7.0'
  
  group :development, :test do
   gem 'factory_bot_rails'
   gem 'faker', '~&gt; 1.4.3'
   gem 'binding_of_caller'
   gem 'quiet_assets'
   gem 'timecop'
   gem 'rspec-rails', '~&gt; 3.7'
   gem 'pry-byebug'
  end
  
  group :development do
    gem 'annotate', '~&gt; 2.7'
  end
  
  group :test do
    gem 'database_cleaner'
    gem 'mocha', require: false
  
   gem 'capybara',            '~&gt; 2.17'
   gem 'selenium-webdriver',  '~&gt; 3.8'
   gem 'chromedriver-helper', '~&gt; 1.1'
   gem 'rack_session_access', '~&gt; 0.1'
   gem 'webmock',             '~&gt; 3.3'
  end
  </code></pre>
  
  <h2>Here is Dockerfile</h2>
  
  <pre><code>FROM ruby:2.5.0
  MAINTAINER lbellet@heliostech.fr
  
  ARG RAILS_ENV=production
  ENV RAILS_ENV ${RAILS_ENV}
  
  ENV APP_HOME=/home/app
  
  RUN groupadd -r app --gid=1000
  RUN useradd -r -m -g app -d /home/app --uid=1000 app
  
  RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \
   &amp;&amp; curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
   &amp;&amp; echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/source$
   &amp;&amp; apt-get update \
   &amp;&amp; apt-get install -y \
        default-libmysqlclient-dev \
        imagemagick \
        gsfonts \
        chromedriver \
        nodejs \
        yarn
  
  WORKDIR $APP_HOME
  
  COPY Gemfile Gemfile.lock $APP_HOME/
  
  # Install dependencies
  RUN mkdir -p /opt/vendor/bundle &amp;&amp; chown -R app:app /opt/vendor
  RUN su app -s /bin/bash -c "bundle install --path /opt/vendor/bundle"
  
  # Copy the main application.
  COPY . $APP_HOME
  
  RUN chown -R app:app /home/app
  USER app
  
  RUN ./bin/init_config \
    &amp;&amp; chmod +x ./bin/logger \
    &amp;&amp; bundle exec rake tmp:create yarn:install assets:precompile
  
  # Expose port 8080 to the Docker host, so we can access it
  # from the outside.
  EXPOSE 8080
  ENTRYPOINT ["bundle", "exec"]
  
  # The main command to run when the container starts. Also
  # tell the Rails dev server to bind to all interfaces by
  # default.
  CMD ["puma", "--config", "config/puma.rb"]
  </code></pre>
  
  <p>I tried to reinstall docker, change ruby version, delete Gemfile.lock, but nothing seems to work. How can I resolve that?</p>