title: How to solve error "bundler could not find compatible version for gem X"
body: <p>I'm trying to setup docker for my project. I have tried installing actionpack 5.0.2, but it did not do me any good. I am following a tutorial on how to setup, so I reckon there are version issues. When I run docker-compose up, this is what I get:</p>
  
  <pre><code>Bundler could not find compatible versions for gem "actionpack":
    In Gemfile:
    rails (~&gt; 5.0.2) ruby depends on
    actionpack (= 5.0.2) ruby
  
    actionpack (&gt;= 5.1.1, ~&gt; 5.1) ruby
  </code></pre>
  
  <p>Here is my Gemfile:</p>
  
  <pre><code>source 'https://rubygems.org'
  
  git_source(:github) do |repo_name|
    repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
    "https://github.com/#{repo_name}.git"
  end
  gem 'devise'
  gem 'bootstrap-sass', '~&gt; 3.3.6'
  gem 'sass-rails', '&gt;= 3.2'
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
  gem 'rails', '~&gt; 5.0.2'
  # Use sqlite3 as the database for Active Record
  #gem 'sqlite3'
  # Use Puma as the app server
  gem 'puma', '~&gt; 3.0'
  # Use Uglifier as compressor for JavaScript assets
  gem 'uglifier', '&gt;= 1.3.0'
  # Use CoffeeScript for .coffee assets and views
  gem 'coffee-rails', '~&gt; 4.2'
  # See https://github.com/rails/execjs#readme for more supported runtimes
  # gem 'therubyracer', platforms: :ruby
  
  # Use jquery as the JavaScript library
  gem 'jquery-rails'
  # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
  gem 'turbolinks', '~&gt; 5'
  # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
  gem 'jbuilder', '~&gt; 2.5'
  # Use Redis adapter to run Action Cable in production
  # gem 'redis', '~&gt; 3.0'
  # Use ActiveModel has_secure_password
  gem 'bcrypt', :platforms =&gt; :ruby
  
  # Use Capistrano for deployment
  # gem 'capistrano-rails', group: :development
  
  group :development, :test do
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console
    gem 'byebug', platform: :mri
  end
  
  group :development do
    # Access an IRB console on exception pages or by using &lt;%= console %&gt; anywhere in the code.
    gem 'web-console', '&gt;= 3.3.0'
  end
  
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
  gem 'unicorn', '~&gt; 4.9'
  gem 'pg', '~&gt; 0.18.3'
  gem 'sidekiq', '~&gt; 4.0.1'
  gem 'redis-rails', '~&gt; 4.0.0'
  gem 'actionpack', '~&gt; 5.1', '&gt;= 5.1.1'
  </code></pre>
  
  <p>EDIT: Tried removing the gem actionpack entirely from the gemfile, caused new issues on docker-compose up:</p>
  
  <pre><code>Bundler could not find compatible versions for gem "actionpack":
    In Gemfile:
      rails (~&gt; 5.0.2) ruby depends on
        actioncable (= 5.0.2) ruby depends on
          actionpack (= 5.0.2) ruby
  
      rails (~&gt; 5.0.2) ruby depends on
        actioncable (= 5.0.2) ruby depends on
          actionpack (= 5.0.2) ruby
  
      rails (~&gt; 5.0.2) ruby depends on
        actioncable (= 5.0.2) ruby depends on
          actionpack (= 5.0.2) ruby
  
      rails (~&gt; 5.0.2) ruby depends on
        actioncable (= 5.0.2) ruby depends on
          actionpack (= 5.0.2) ruby
  
      redis-rails (~&gt; 4.0.0) ruby depends on
        redis-actionpack (~&gt; 4) ruby depends on
          actionpack (~&gt; 4) ruby
  ERROR: Service 'drkiq' failed to build: The command '/bin/sh -c bundle install' returned a non-zero code: 6
  </code></pre>