Rails & Docker: configure bundler to run bundle install in a docker build for Rails.4.2.6?

I am having so much trouble with docker. It seems to be a pattern. I have a dockerfile which installs Node.js and Yarn from source repositories fine. I install ruby from the get-apt repositories (which gives me 2.3.0), then RVM and update Ruby to 2.3.3 (what my application has been using)... but then, when I go to run bundle install I get a version conflict with Rails:

Could not find gem 'bundler (< 2.0, >= 1.3.0)', which is required by gem 'rails
(= 4.2.6)', in any of the sources.
ERROR: Service 'theaterengine' failed to build: The command '/bin/sh -c /bin/bash -l -c "bundle install"' returned a non-zero code: 6

I have tried explicitly installing lower versions of bundler but it always seems to try and use that version. I have tried deleting Gemfile.lock as well. Please help

Dockerfile:

FROM ubuntu:16.04

ENV LANG C.UTF-8

ENV BUNDLE_PATH=\bundle

RUN apt-get update -qq && apt-get install -y build-essential libpq-dev gnupg2 curl

# INSTALL NODE.JS

RUN groupadd --gid 1000 node \
  && useradd --uid 1000 --gid node --shell /bin/bash --create-home node

# gpg keys listed at https://github.com/nodejs/node#release-team
RUN set -ex \
  && for key in \
      4ED778F539E3634C779C87C6D7062848A1AB005C \
      B9E2F5981AA6E0CD28160D9FF13993A75599653C \ 
      94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
      B9AE9905FFD7803F25714661B63B535A4C206CA9 \
      77984A986EBC2AA786BC0F66B01FBB92821C587A \
      71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
      FD3A5288F042B6850C66B31F09FE44734EB7990E \
      8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
      C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
      DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
      A48C2BEE680E841632CD4E44F07496B3EB3C1762 \
  ; do \
    gpg --batch --keyserver hkp://pool.sks-keyservers.net --recv-keys "$key" || \
    gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
    gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \
    gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \
  done

ENV NODE_MAJOR 10

RUN NODE_VERSION=$(curl -SL "https://nodejs.org/dist/index.tab" \
  | grep "^v$NODE_MAJOR" \
  | head -n 1 | awk '{ print substr($1,2) }') \
  && ARCH= && dpkgArch="$(dpkg --print-architecture)" \
  && case "${dpkgArch##*-}" in \
    amd64) ARCH='x64';; \
    ppc64el) ARCH='ppc64le';; \
    s390x) ARCH='s390x';; \
    arm64) ARCH='arm64';; \
    armhf) ARCH='armv7l';; \
    i386) ARCH='x86';; \
    *) echo "unsupported architecture"; exit 1 ;; \
  esac \
  && curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
  && curl -SLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
  && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
  && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
  && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
  && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \
  && ln -s /usr/local/bin/node /usr/local/bin/nodejs

# INSTALL YARN

RUN YARN_VERSION=$(curl -sSL --compressed https://yarnpkg.com/latest-version) \
  set -ex \
  && for key in \
    6A010C5166006599AA17F08146C2130DFD2497F5 \
  ; do \
    gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
    gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \
    gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \
  done \
  && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
  && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \
  && gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
  && mkdir -p /opt \
  && tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \
  && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
  && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \
  && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz

# INSTALL OTHER DEPENDENCIES

RUN apt-get update -qq && apt-get install -y git \
    libxml2-dev \
    libxslt1-dev \
    libqt4-dev \
    libqtwebkit4 \
    xvfb \
    file \
    libcurl4-gnutls-dev 

# INSTALL RVM AND RUBY

RUN \
  apt-get update && \
  apt-get install -y ruby ruby-dev bundler && \
  rm -rf /var/lib/lists/*

RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
RUN curl -sSl https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer | bash -s stable

RUN ["/bin/bash", "-l", "-c", "rvm requirements"]
RUN ["/bin/bash", "-l", "-c", "rvm install 2.3.3 --default"]
RUN /bin/bash -l -c "gem env && bundle config && gem install bundler --version 1.17.3"

# RAILS ENV VARIABLES AND BUNDLING

ENV APP_HOME /theaterengine
RUN mkdir $APP_HOME
WORKDIR $APP_HOME

COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock

ENV BUNDLE_GEMFILE=$APP_HOME/Gemfile \
  BUNDLE_JOBS=2

RUN /bin/bash -l -c "bundle install"
# RUN ["/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.17.3/exe/bundle", "install"]

ADD . $APP_HOME

docker-compose.yml:

version: '2'
services:
  theaterengine:
    extends:
      file: docker-common.yml
      service: web
    links:
      - postgres
      - redis
      - elasticsearch
    env_file:
      - .theaterengine.env


  postgres:
    volumes:
      - ./scripts:/docker-entrypoint-initdb.d
    extends:
      file: docker-common.yml
      service: postgres

  redis:
    extends:
      file: docker-common.yml
      service: redis

  elasticsearch:
    extends:
      file: docker-common.yml
      service: elasticsearch

  sidekiq:
    extends:
      file: docker-common.yml
      service: sidekiq
    links:
      - postgres
      - redis

volumes:
  bundle: {}
  postgres: {}
  redis: {}

docker-common.yml:

version: '2'
services:
  web:
    build: .
    command: bin/rails server --port 8000 --binding 0.0.0.0
    volumes:
      - .:/theaterengine
      - bundle:/bundle
    ports:
      - '80:8000'
    env_file:
      - .theaterengine.env

  postgres:
    image: postgres:9.6.2
    environment:
      POSTGRES_USER: theaterengine
      POSTGRES_PASSWORD: theaterengine
    ports:
      - '5432:5432'
    volumes:
      - postgres:/var/lib/postgresql/data

  redis:
    image: redis:latest
    ports:
      - '6379:6379'
    volumes:
      - redis:/var/lib/redis/data

  elasticsearch:
    image: elasticsearch:5.6
    command: elasticsearch
    environment:
      ES_JAVA_OPTS: "-Des.network.host=0.0.0.0 -Xmx1024m -Xms256m -Des.scripting.exception_for_missing_value=true"

  sidekiq:
    build: .
    command: bundle exec sidekiq -C config/sidekiq.yml
    volumes:
      - .:/theaterengine
      - bundle:/bundle
    env_file:
      - .theaterengine.env

output of docker-compose build --no-cache theaterengine

Building theaterengine
Step 1/24 : FROM ubuntu:16.04
 ---> 7e87e2b3bf7a
Step 2/24 : ENV LANG C.UTF-8
 ---> Running in ae5029491687
Removing intermediate container ae5029491687
 ---> 5912b6c9d20d
Step 3/24 : ENV BUNDLE_PATH=\bundle
 ---> Running in 2cb056b4fc6b
Removing intermediate container 2cb056b4fc6b
 ---> 31f18e8fa92e
Step 4/24 : RUN apt-get update -qq && apt-get install -y build-essential libpq-dev gnupg2 curl
 ---> Running in e9f4cec8e789
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  binutils bzip2 ca-certificates comerr-dev cpp cpp-5 dirmngr dpkg-dev
  fakeroot g++ g++-5 gcc gcc-5 gnupg-agent ifupdown iproute2 isc-dhcp-client
  isc-dhcp-common krb5-locales krb5-multidev libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan2 libasn1-8-heimdal
  libassuan0 libatm1 libatomic1 libc-dev-bin libc6-dev libcc1-0 libcilkrts5
  libcurl3-gnutls libdns-export162 libdpkg-perl libfakeroot libffi6
  libfile-fcntllock-perl libgcc-5-dev libgdbm3 libgmp10 libgnutls30 libgomp1
  libgssapi-krb5-2 libgssapi3-heimdal libgssrpc4 libhcrypto4-heimdal
  libheimbase1-heimdal libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal
  libidn11 libisc-export160 libisl15 libitm1 libk5crypto3 libkadm5clnt-mit9
  libkadm5srv-mit9 libkdb5-8 libkeyutils1 libkrb5-26-heimdal libkrb5-3
  libkrb5support0 libksba8 libldap-2.4-2 liblsan0 libmnl0 libmpc3 libmpfr4
  libmpx0 libnettle6 libnpth0 libp11-kit0 libperl5.22 libpq5 libquadmath0
  libroken18-heimdal librtmp1 libsasl2-2 libsasl2-modules libsasl2-modules-db
  libsqlite3-0 libssl-dev libssl-doc libssl1.0.0 libstdc++-5-dev libtasn1-6
  libtsan0 libubsan0 libwind0-heimdal libxtables11 linux-libc-dev make
  manpages manpages-dev netbase openssl patch perl perl-modules-5.22
  pinentry-curses rename xz-utils zlib1g-dev
Suggested packages:
  binutils-doc bzip2-doc doc-base cpp-doc gcc-5-locales debian-keyring
  g++-multilib g++-5-multilib gcc-5-doc libstdc++6-5-dbg gcc-multilib autoconf
  automake libtool flex bison gdb gcc-doc gcc-5-multilib libgcc1-dbg
  libgomp1-dbg libitm1-dbg libatomic1-dbg libasan2-dbg liblsan0-dbg
  libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx0-dbg libquadmath0-dbg
  gnupg-doc parcimonie xloadimage ppp rdnssd iproute2-doc resolvconf
  avahi-autoipd isc-dhcp-client-ddns apparmor krb5-doc glibc-doc gnutls-bin
  krb5-user postgresql-doc-9.5 libsasl2-modules-otp libsasl2-modules-ldap
  libsasl2-modules-sql libsasl2-modules-gssapi-mit
  | libsasl2-modules-gssapi-heimdal libstdc++-5-doc make-doc man-browser ed
  diffutils-doc perl-doc libterm-readline-gnu-perl
  | libterm-readline-perl-perl pinentry-doc
The following NEW packages will be installed:
  binutils build-essential bzip2 ca-certificates comerr-dev cpp cpp-5 curl
  dirmngr dpkg-dev fakeroot g++ g++-5 gcc gcc-5 gnupg-agent gnupg2 ifupdown
  iproute2 isc-dhcp-client isc-dhcp-common krb5-locales krb5-multidev
  libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
  libasan2 libasn1-8-heimdal libassuan0 libatm1 libatomic1 libc-dev-bin
  libc6-dev libcc1-0 libcilkrts5 libcurl3-gnutls libdns-export162 libdpkg-perl
  libfakeroot libffi6 libfile-fcntllock-perl libgcc-5-dev libgdbm3 libgmp10
  libgnutls30 libgomp1 libgssapi-krb5-2 libgssapi3-heimdal libgssrpc4
  libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhogweed4
  libhx509-5-heimdal libidn11 libisc-export160 libisl15 libitm1 libk5crypto3
  libkadm5clnt-mit9 libkadm5srv-mit9 libkdb5-8 libkeyutils1 libkrb5-26-heimdal
  libkrb5-3 libkrb5support0 libksba8 libldap-2.4-2 liblsan0 libmnl0 libmpc3
  libmpfr4 libmpx0 libnettle6 libnpth0 libp11-kit0 libperl5.22 libpq-dev
  libpq5 libquadmath0 libroken18-heimdal librtmp1 libsasl2-2 libsasl2-modules
  libsasl2-modules-db libsqlite3-0 libssl-dev libssl-doc libssl1.0.0
  libstdc++-5-dev libtasn1-6 libtsan0 libubsan0 libwind0-heimdal libxtables11
  linux-libc-dev make manpages manpages-dev netbase openssl patch perl
  perl-modules-5.22 pinentry-curses rename xz-utils zlib1g-dev
0 upgraded, 108 newly installed, 0 to remove and 0 not upgraded.
Need to get 57.6 MB of archives.
...
...
148 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Removing intermediate container e9f4cec8e789
 ---> 66fa6d267a05
Step 5/24 : RUN groupadd --gid 1000 node   && useradd --uid 1000 --gid node --shell /bin/bash --create-home node
 ---> Running in b7e86d75e030
Removing intermediate container b7e86d75e030
 ---> eeaf38d31a2a
Step 6/24 : RUN set -ex   && for key in       4ED778F539E3634C779C87C6D7062848A1AB005C       B9E2F5981AA6E0CD28160D9FF13993A75599653C       94AE36675C464D64BAFA68DD7434390BDBE9B9C5       B9AE9905FFD7803F25714661B63B535A4C206CA9       77984A986EBC2AA786BC0F66B01FBB92821C587A       71DCFD284A79C3B38668286BC97EC7A07EDE3FC1       FD3A5288F042B6850C66B31F09FE44734EB7990E       8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600       C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8       DD8F2338BAE7501E3DD5AC78C273792F7D83545D       A48C2BEE680E841632CD4E44F07496B3EB3C1762   ; do     gpg --batch --keyserver hkp://pool.sks-keyservers.net --recv-keys "$key" ||     gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ||     gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" ||     gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ;   done
 ---> Running in 55265cf5a4fa
...
...
Removing intermediate container 55265cf5a4fa
 ---> 7d3de60af5fc
Step 7/24 : ENV NODE_MAJOR 10
 ---> Running in 57f05fb87dd7
Removing intermediate container 57f05fb87dd7
 ---> 9df11bd47c50
Step 8/24 : RUN NODE_VERSION=$(curl -SL "https://nodejs.org/dist/index.tab"   | grep "^v$NODE_MAJOR"   | head -n 1 | awk '{ print substr($1,2) }')   && ARCH= && dpkgArch="$(dpkg --print-architecture)"   && case "${dpkgArch##*-}" in     amd64) ARCH='x64';;     ppc64el) ARCH='ppc64le';;     s390x) ARCH='s390x';;     arm64) ARCH='arm64';;     armhf) ARCH='armv7l';;     i386) ARCH='x86';;     *) echo "unsupported architecture"; exit 1 ;;   esac   && curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz"   && curl -SLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc"   && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc   && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c -   && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner   && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt   && ln -s /usr/local/bin/node /usr/local/bin/nodejs
 ---> Running in 0b8e7b8bb68f
...
...
Removing intermediate container 0b8e7b8bb68f
 ---> 56204b1054e0
Step 9/24 : RUN YARN_VERSION=$(curl -sSL --compressed https://yarnpkg.com/latest-version)   set -ex   && for key in     6A010C5166006599AA17F08146C2130DFD2497F5   ; do     gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ||     gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" ||     gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ;   done   && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz"   && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc"   && gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz   && mkdir -p /opt   && tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/   && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn   && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg   && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz
 ---> Running in 6a45f5c124a7
+ gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 6A010C5166006599AA17F08146C2130DFD2497F5
gpg: requesting key FD2497F5 from hkp server p80.pool.sks-keyservers.net
gpg: key 86E50310: public key "Yarn Packaging <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
...
...
+ mkdir -p /opt
+ tar -xzf yarn-v1.13.0.tar.gz -C /opt/
+ ln -s /opt/yarn-v1.13.0/bin/yarn /usr/local/bin/yarn
+ ln -s /opt/yarn-v1.13.0/bin/yarnpkg /usr/local/bin/yarnpkg
+ rm yarn-v1.13.0.tar.gz.asc yarn-v1.13.0.tar.gz
Removing intermediate container 6a45f5c124a7
 ---> 83ed68b00e7d
Step 10/24 : RUN apt-get update -qq && apt-get install -y git     libxml2-dev     libxslt1-dev     libqt4-dev     libqtwebkit4     xvfb     file     libcurl4-gnutls-dev
 ---> Running in 10d6197af7ca
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  dbus fontconfig fontconfig-config fonts-dejavu-core git-man
  gstreamer1.0-plugins-base icu-devtools iso-codes less libaudio2
  libavahi-client3 libavahi-common-data libavahi-common3 libbsd0 libcap-ng0
  libcdparanoia0 libcups2 libdbus-1-3 libdrm-amdgpu1 libdrm-common libdrm-dev
  libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libedit2 libelf1
  liberror-perl libexpat1 libfontconfig1 libfontenc1 libfreetype6
  libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libglib2.0-0
  libglib2.0-data libglu1-mesa libglu1-mesa-dev libgstreamer-plugins-base1.0-0
  libgstreamer1.0-0 libice6 libicu-dev libicu55 libjbig0 libjpeg-turbo8
  libjpeg8 liblcms2-2 libllvm6.0 libmagic1 libmng2 libmysqlclient20 libogg0
  libopus0 liborc-0.4-0 libpciaccess0 libpixman-1-0 libpng12-0 libpopt0
  libpthread-stubs0-dev libqt4-dbus libqt4-declarative libqt4-designer
  libqt4-dev-bin libqt4-help libqt4-network libqt4-opengl libqt4-opengl-dev
  libqt4-qt3support libqt4-script libqt4-scripttools libqt4-sql
  libqt4-sql-mysql libqt4-svg libqt4-test libqt4-xml libqt4-xmlpatterns
  libqtcore4 libqtdbus4 libqtgui4 libsensors4 libsm6 libtheora0 libtiff5
  libtxc-dxtn-s2tc0 libvisual-0.4-0 libvorbis0a libvorbisenc2 libx11-6
  libx11-data libx11-dev libx11-doc libx11-xcb-dev libx11-xcb1 libxau-dev
  libxau6 libxaw7 libxcb-dri2-0 libxcb-dri2-0-dev libxcb-dri3-0
  libxcb-dri3-dev libxcb-glx0 libxcb-glx0-dev libxcb-present-dev
  libxcb-present0 libxcb-randr0 libxcb-randr0-dev libxcb-render0
  libxcb-render0-dev libxcb-shape0 libxcb-shape0-dev libxcb-sync-dev
  libxcb-sync1 libxcb-xfixes0 libxcb-xfixes0-dev libxcb1 libxcb1-dev
  libxdamage-dev libxdamage1 libxdmcp-dev libxdmcp6 libxext-dev libxext6
  libxfixes-dev libxfixes3 libxfont1 libxi6 libxkbfile1 libxml2 libxmu6
  libxmuu1 libxpm4 libxrender1 libxshmfence-dev libxshmfence1 libxslt1.1
  libxt6 libxxf86vm-dev libxxf86vm1 mesa-common-dev mysql-common
  openssh-client qdbus qt-at-spi qt4-linguist-tools qt4-qmake qtchooser
  qtcore4-l10n rsync sgml-base shared-mime-info ucf x11-common x11-xkb-utils
  x11proto-core-dev x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev
  x11proto-gl-dev x11proto-input-dev x11proto-kb-dev x11proto-xext-dev
  x11proto-xf86vidmode-dev xauth xdg-user-dirs xfonts-base xfonts-encodings
  xfonts-utils xkb-data xml-core xorg-sgml-doctools xserver-common xtrans-dev
Suggested packages:
  dbus-user-session | dbus-x11 gettext-base git-daemon-run
  | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch
  git-cvs git-mediawiki git-svn gvfs isoquery nas cups-common libcurl4-doc
  libcurl3-dbg libgnutls-dev libidn11-dev libkrb5-dev libldap2-dev librtmp-dev
  pkg-config libvisual-0.4-plugins gstreamer1.0-tools icu-doc liblcms2-utils
  opus-tools pciutils libqt4-declarative-folderlistmodel
  libqt4-declarative-gestures libqt4-declarative-particles
  libqt4-declarative-shaders qt4-qmlviewer firebird-dev libmysqlclient-dev
  libsqlite0-dev libsqlite3-dev qt4-dev-tools qt4-doc unixodbc-dev libthai0
  qt4-qtconfig lm-sensors libxcb-doc libxext-doc ssh-askpass libpam-ssh
  keychain monkeysphere openssh-server sgml-base-doc debhelper
The following NEW packages will be installed:
  dbus file fontconfig fontconfig-config fonts-dejavu-core git git-man
  gstreamer1.0-plugins-base icu-devtools iso-codes less libaudio2
  libavahi-client3 libavahi-common-data libavahi-common3 libbsd0 libcap-ng0
  libcdparanoia0 libcups2 libcurl4-gnutls-dev libdbus-1-3 libdrm-amdgpu1
  libdrm-common libdrm-dev libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
  libdrm2 libedit2 libelf1 liberror-perl libexpat1 libfontconfig1 libfontenc1
  libfreetype6 libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa
  libglib2.0-0 libglib2.0-data libglu1-mesa libglu1-mesa-dev
  libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 libice6 libicu-dev libicu55
  libjbig0 libjpeg-turbo8 libjpeg8 liblcms2-2 libllvm6.0 libmagic1 libmng2
  libmysqlclient20 libogg0 libopus0 liborc-0.4-0 libpciaccess0 libpixman-1-0
  libpng12-0 libpopt0 libpthread-stubs0-dev libqt4-dbus libqt4-declarative
  libqt4-designer libqt4-dev libqt4-dev-bin libqt4-help libqt4-network
  libqt4-opengl libqt4-opengl-dev libqt4-qt3support libqt4-script
  libqt4-scripttools libqt4-sql libqt4-sql-mysql libqt4-svg libqt4-test
  libqt4-xml libqt4-xmlpatterns libqtcore4 libqtdbus4 libqtgui4 libqtwebkit4
  libsensors4 libsm6 libtheora0 libtiff5 libtxc-dxtn-s2tc0 libvisual-0.4-0
  libvorbis0a libvorbisenc2 libx11-6 libx11-data libx11-dev libx11-doc
  libx11-xcb-dev libx11-xcb1 libxau-dev libxau6 libxaw7 libxcb-dri2-0
  libxcb-dri2-0-dev libxcb-dri3-0 libxcb-dri3-dev libxcb-glx0 libxcb-glx0-dev
  libxcb-present-dev libxcb-present0 libxcb-randr0 libxcb-randr0-dev
  libxcb-render0 libxcb-render0-dev libxcb-shape0 libxcb-shape0-dev
  libxcb-sync-dev libxcb-sync1 libxcb-xfixes0 libxcb-xfixes0-dev libxcb1
  libxcb1-dev libxdamage-dev libxdamage1 libxdmcp-dev libxdmcp6 libxext-dev
  libxext6 libxfixes-dev libxfixes3 libxfont1 libxi6 libxkbfile1 libxml2
  libxml2-dev libxmu6 libxmuu1 libxpm4 libxrender1 libxshmfence-dev
  libxshmfence1 libxslt1-dev libxslt1.1 libxt6 libxxf86vm-dev libxxf86vm1
  mesa-common-dev mysql-common openssh-client qdbus qt-at-spi
  qt4-linguist-tools qt4-qmake qtchooser qtcore4-l10n rsync sgml-base
  shared-mime-info ucf x11-common x11-xkb-utils x11proto-core-dev
  x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-gl-dev
  x11proto-input-dev x11proto-kb-dev x11proto-xext-dev
  x11proto-xf86vidmode-dev xauth xdg-user-dirs xfonts-base xfonts-encodings
  xfonts-utils xkb-data xml-core xorg-sgml-doctools xserver-common xtrans-dev
  xvfb
...
...
Removing intermediate container 10d6197af7ca
 ---> f797cd358613
Step 11/24 : RUN   apt-get update &&   apt-get install -y ruby ruby-dev bundler &&   rm -rf /var/lib/lists/*
 ---> Running in cddd19cdbe85
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  fonts-lato javascript-common libgmp-dev libgmpxx4ldbl libjs-jquery
  libruby2.3 libyaml-0-2 rake ruby-bundler ruby-did-you-mean ruby-minitest
  ruby-molinillo ruby-net-http-persistent ruby-net-telnet ruby-power-assert
  ruby-test-unit ruby-thor ruby2.3 ruby2.3-dev rubygems-integration sudo unzip
  zip
Suggested packages:
  apache2 | lighttpd | httpd gmp-doc libgmp10-doc libmpfr-dev ri
The following NEW packages will be installed:
  bundler fonts-lato javascript-common libgmp-dev libgmpxx4ldbl libjs-jquery
  libruby2.3 libyaml-0-2 rake ruby ruby-bundler ruby-dev ruby-did-you-mean
  ruby-minitest ruby-molinillo ruby-net-http-persistent ruby-net-telnet
  ruby-power-assert ruby-test-unit ruby-thor ruby2.3 ruby2.3-dev
  rubygems-integration sudo unzip zip
0 upgraded, 26 newly installed, 0 to remove and 0 not upgraded.
Need to get 8357 kB of archives.
...
...
Removing intermediate container cddd19cdbe85
 ---> 6a0b2f77087b
Step 12/24 : RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
 ---> Running in c185a2f95fbd
gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
gpg: requesting key 39499BDB from hkp server keys.gnupg.net
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <[email protected]>" imported
gpg: key 39499BDB: public key "Piotr Kuczynski <[email protected]>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 2
gpg:               imported: 2  (RSA: 2)
Removing intermediate container c185a2f95fbd
 ---> 28942e1516c8
Step 13/24 : RUN curl -sSl https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer | bash -s stable
 ---> Running in 4521aa379be2
Downloading https://github.com/rvm/rvm/archive/1.29.7.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.7...
...
...
/1.29.7.tar.gz.asc

Removing intermediate container 4521aa379be2
 ---> 326d003275db
Step 14/24 : RUN ["/bin/bash", "-l", "-c", "rvm requirements"]
 ---> Running in 9b7cf125de07
mesg: ttyname failed: Inappropriate ioctl for device
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system..
Installing required packages: gawk, autoconf, automake, bison, libffi-dev, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, pkg-config, sqlite3, libreadline6-dev.............
Requirements installation successful.
Removing intermediate container 9b7cf125de07
 ---> bc89ea7eb165
Step 15/24 : RUN ["/bin/bash", "-l", "-c", "rvm install 2.3.3 --default"]
 ---> Running in 938d6dbb8e50
mesg: ttyname failed: Inappropriate ioctl for device
RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.2
  - RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-2.3.3
  - USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-2.3.3/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-2.3.3/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/rvm/gems/ruby-2.3.3
     - /usr/local/rvm/gems/[email protected]
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/rvm/gems/ruby-2.3.3/bin
     - /usr/local/rvm/gems/[email protected]/bin
     - /usr/local/rvm/rubies/ruby-2.3.3/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/local/rvm/bin
Settings are listed in order of priority. The top value will be used.
path
Set via BUNDLE_PATH: "bundle"

Successfully installed bundler-1.17.3
Parsing documentation for bundler-1.17.3
Installing ri documentation for bundler-1.17.3
Done installing documentation for bundler after 35 seconds
1 gem installed
Removing intermediate container d77b774c18b3
 ---> ed73a09a9ce1
Step 17/24 : ENV APP_HOME /theaterengine
 ---> Running in 23dd5a5a2564
Removing intermediate container 23dd5a5a2564
 ---> 31bb685d4a18
Step 18/24 : RUN mkdir $APP_HOME
 ---> Running in e249f33df047
Removing intermediate container e249f33df047
 ---> 0c4655341563
Step 19/24 : WORKDIR $APP_HOME
Removing intermediate container 2b66d8ba845d
 ---> a006fb0074b8
Step 20/24 : COPY Gemfile Gemfile
 ---> dd19d7576314
Step 21/24 : COPY Gemfile.lock Gemfile.lock
 ---> aafe1a3149d4
Step 22/24 : ENV BUNDLE_GEMFILE=$APP_HOME/Gemfile   BUNDLE_JOBS=2
 ---> Running in afd6c6d74122
Removing intermediate container afd6c6d74122
 ---> 802e91bda185
Step 23/24 : RUN /bin/bash -l -c "bundle install"
 ---> Running in c896b57d062b
mesg: ttyname failed: Inappropriate ioctl for device
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching https://github.com/gavinkflam/lightbox2-rails.git
Fetching https://github.com/nathanvda/cocoon.git
Fetching https://github.com/derekprior/momentjs-rails.git
Fetching https://github.com/zpaulovics/datetimepicker-rails.git
Cloning into 'bootstrap-datetimepicker'...
Fetching https://github.com/jhenahan/administrate.git
Fetching gem metadata from https://rails-assets.org/...
Fetching gem metadata from https://rails-assets.org/..
Fetching gem metadata from https://rubygems.org/..............
Fetching gem metadata from https://rails-assets.org/..
Fetching gem metadata from https://rails-assets.org/..
Fetching gem metadata from https://rubygems.org/...
Fetching gem metadata from https://rails-assets.org/..
Fetching gem metadata from https://rails-assets.org/..
Fetching gem metadata from https://rubygems.org/...
Resolving dependencies.............................................................
Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    rails (= 4.2.6) was resolved to 4.2.6, which depends on
      bundler (< 2.0, >= 1.3.0)

  Current Bundler version:
    bundler (2.0.1)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?

Could not find gem 'bundler (< 2.0, >= 1.3.0)', which is required by gem 'rails
(= 4.2.6)', in any of the sources.
ERROR: Service 'theaterengine' failed to build: The command '/bin/sh -c /bin/bash -l -c "bundle install"' returned a non-zero code: 6