title: docker-compose picks the wrong ruby version
body: <p>When running docker-compose, it seems to pick the wrong ruby program.
  Using rbenv I have installed version 2.6.2
  But there is also a version under /usr/bin that is at 2.6.3. I can't delete that version, also not as sudo.
  I have already uninstalled rbenv and re-installed it.</p>
  
  <p>The strange thing is this:</p>
  
  <pre><code>MBP-Andre:biblestudy_platform andreheijstek$ which ruby
  /Users/andreheijstek/.rbenv/shims/ruby
  MBP-Andre:biblestudy_platform andreheijstek$ whereis ruby
  /usr/bin/ruby
  </code></pre>
  
  <p>When I run docker-compose, it seems to pick the usr/bin/ruby, which is the wrong one!</p>
  
  <p>I've tried to take all the advise under <a href="https://stackoverflow.com/questions/10940736/rbenv-not-changing-ruby-version?">rbenv not changing ruby version</a> but nothing helps.
  Any ideas?</p>
  
  <p>Maybe some more background to clarify the situation.
  I have followed this advise to dockerise my existing rails app.
  <a href="https://evilmartians.com/chronicles/ruby-on-whales-docker-for-ruby-rails-development" rel="nofollow noreferrer">https://evilmartians.com/chronicles/ruby-on-whales-docker-for-ruby-rails-development</a></p>
  
  <p>Here, the docker-compose wil create the docker.
  My docker-compose.yml</p>
  
  <pre><code>version: '3.4'
  
  x-app: &amp;app
    build:
      context: .
      dockerfile: ./.dockerdev/Dockerfile
      args:
        RUBY_VERSION: '2.6.2'
        PG_MAJOR: '11'
        NODE_MAJOR: '11'
        YARN_VERSION: '1.13.0'
        BUNDLER_VERSION: '2.0.2'
    environment: &amp;env
      NODE_ENV: development
      RAILS_ENV: ${RAILS_ENV:-development}
    image: example-dev:1.0.0
    tmpfs:
      - /tmp
  
  x-backend: &amp;backend
    &lt;&lt;: *app
    stdin_open: true
    tty: true
    volumes:
      - .:/app:cached
      - rails_cache:/app/tmp/cache
      - bundle:/bundle
      - node_modules:/app/node_modules
      - packs:/app/public/packs
      - .dockerdev/.psqlrc:/root/.psqlrc:ro
    environment:
      &lt;&lt;: *env
      REDIS_URL: redis://redis:6379/
      DATABASE_URL: postgres://postgres:postgres@postgres:5432
      BOOTSNAP_CACHE_DIR: /bundle/bootsnap
      WEBPACKER_DEV_SERVER_HOST: webpacker
      WEB_CONCURRENCY: 1
      HISTFILE: /app/log/.bash_history
      PSQL_HISTFILE: /app/log/.psql_history
      EDITOR: vi
    depends_on:
      - postgres
      - redis
  
  services:
    runner:
      &lt;&lt;: *backend
      command: /bin/bash
      ports:
        - '3000:3000'
        - '3002:3002'
  
    rails:
      &lt;&lt;: *backend
      command: bundle exec rails server -b 0.0.0.0
      ports:
        - '3000:3000'
  
    sidekiq:
      &lt;&lt;: *backend
      command: bundle exec sidekiq -C config/sidekiq.yml
  
    postgres:
      image: postgres:11.1
      volumes:
        - .dockerdev/.psqlrc:/root/.psqlrc:ro
        - postgres:/var/lib/postgresql/data
        - ./log:/root/log:cached
      environment:
        PSQL_HISTFILE: /root/log/.psql_history
      ports:
        - 5432
  
    redis:
      image: redis:3.2-alpine
      volumes:
        - redis:/data
      ports:
        - 6379
  
    webpacker:
      &lt;&lt;: *app
      command: ./bin/webpack-dev-server
      ports:
        - '3035:3035'
      volumes:
        - .:/app:cached
        - bundle:/bundle
        - node_modules:/app/node_modules
        - packs:/app/public/packs
      environment:
        &lt;&lt;: *env
        WEBPACKER_DEV_SERVER_HOST: 0.0.0.0
  
  volumes:
    postgres:
    redis:
    bundle:
    node_modules:
    rails_cache:
    packs:
  </code></pre>
  
  <p>And my Dockerfile</p>
  
  <pre><code># Taken from: https://evilmartians.com/chronicles/ruby-on-whales-docker-for-ruby-rails-development
  
  ARG RUBY_VERSION
  FROM ruby:$RUBY_VERSION
  
  RUN echo RUBY_VERSION
  
  ARG PG_MAJOR
  ARG NODE_MAJOR
  ARG BUNDLER_VERSION
  ARG YARN_VERSION
  
  # Add PostgreSQL to sources list
  RUN curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
    &amp;&amp; echo 'deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main' $PG_MAJOR &gt; /etc/apt/sources.list.d/pgdg.list
  
  # Add NodeJS to sources list
  RUN curl -sL https://deb.nodesource.com/setup_$NODE_MAJOR.x | bash -
  
  # Add Yarn to the sources list
  RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
    &amp;&amp; echo 'deb http://dl.yarnpkg.com/debian/ stable main' &gt; /etc/apt/sources.list.d/yarn.list
  
  # Install dependencies
  COPY .dockerdev/Aptfile /tmp/Aptfile
  RUN apt-get update -qq &amp;&amp; DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade &amp;&amp; \
    DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
      build-essential \
      postgresql-client-$PG_MAJOR \
      nodejs \
      yarn=$YARN_VERSION-1 \
      $(cat /tmp/Aptfile | xargs) &amp;&amp; \
      apt-get clean &amp;&amp; \
      rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* &amp;&amp; \
      truncate -s 0 /var/log/*log
  
  # Configure bundler and PATH
  ENV LANG=C.UTF-8 \
    GEM_HOME=/bundle \
    BUNDLE_JOBS=4 \
    BUNDLE_RETRY=3
  ENV BUNDLE_PATH $GEM_HOME
  ENV BUNDLE_APP_CONFIG=$BUNDLE_PATH \
    BUNDLE_BIN=$BUNDLE_PATH/bin
  ENV PATH /app/bin:$BUNDLE_BIN:$PATH
  
  # Upgrade RubyGems and install required Bundler version
  RUN gem update --system &amp;&amp; \
      gem install bundler:$BUNDLER_VERSION
  
  # Create a directory for the app code
  RUN mkdir -p /app
  
  WORKDIR /app
  </code></pre>
  
  <p>When I try to create everything, this happens:</p>
  
  <pre><code>MBP-Andre:biblestudy_platform andreheijstek$ docker-compose up rails
  biblestudy_platform_postgres_1 is up-to-date
  biblestudy_platform_redis_1 is up-to-date
  Starting biblestudy_platform_rails_1 ... done
  Attaching to biblestudy_platform_rails_1
  rails_1      | Your Ruby version is 2.6.3, but your Gemfile specified 2.6.2
  biblestudy_platform_rails_1 exited with code 18
  </code></pre>