Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker build: executor failed running [/bin/sh -c bundle install --full-index]: exit code: 7 #4666

Open
ProgrammingVibes opened this issue Aug 23, 2021 · 5 comments
Labels

Comments

@ProgrammingVibes
Copy link

Description

Type: Bug
Docker build fails due to bundle install --full-index failing.

Current Behavior

ran docker build . with Dockerfile as the following:

FROM ruby:2.6.8-buster

ENV DEBIAN_FRONTEND noninteractive

# Install essential Linux packages
RUN apt-get update -qq
RUN apt-get install -y build-essential libpq-dev postgresql-client nodejs imagemagick sudo libxss1 libappindicator1 libindicator7 unzip memcached cmake pkg-config shared-mime-info

# Files created inside the container repect the ownership
RUN adduser --shell /bin/bash --disabled-password --gecos "" consul \
  && adduser consul sudo \
  && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

RUN echo 'Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bundle/bin"' > /etc/sudoers.d/secure_path
RUN chmod 0440 /etc/sudoers.d/secure_path

COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh

# Define where our application will live inside the image
ENV RAILS_ROOT /var/www/consul

# Create application home. App server will need the pids dir so just create everything in one shot
RUN mkdir -p $RAILS_ROOT/tmp/pids

# Set our working directory inside the image
WORKDIR $RAILS_ROOT

# Use the Gemfiles as Docker cache markers. Always bundle before copying app src.
# (the src likely changed and we don't want to invalidate Docker's cache too early)
# http://ilikestuffblog.com/2014/01/06/how-to-skip-bundle-install-when-deploying-a-rails-app-to-docker/
COPY Gemfile Gemfile

COPY Gemfile.lock Gemfile.lock

COPY Gemfile_custom Gemfile_custom

# Prevent bundler warnings; ensure that the bundler version executed is >= that which created Gemfile.lock
RUN gem install bundler

# Finish establishing our Ruby environment
RUN bundle install --full-index

# Install Chromium for E2E integration tests
RUN apt-get update -qq && apt-get install -y chromium

# Copy the Rails application into place
COPY . .

# Define the script we want run once the container boots
# Use the "exec" form of CMD so our script shuts down gracefully on SIGTERM (i.e. `docker stop`)
# CMD [ "config/containers/app_cmd.sh" ]
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]

The following was outputted:

[+] Building 62.0s (19/21)
=> [internal] load build definition from Dockerfile                                                                                                                             0.0s 
=> => transferring dockerfile: 2.11kB                                                                                                                                           0.0s 
=> [internal] load .dockerignore                                                                                                                                                0.0s 
=> => transferring context: 2B                                                                                                                                                  0.0s 
=> [internal] load metadata for docker.io/library/ruby:2.6.8-buster                                                                                                             0.7s 
=> [auth] library/ruby:pull token for registry-1.docker.io                                                                                                                      0.0s 
=> [ 1/16] FROM docker.io/library/ruby:2.6.8-buster@sha256:e2f52bf531fd1c03910dace91aa41dc27d9b1d79a0bcacb7aa7f95e269b78d2a                                                     8.0s 
=> => resolve docker.io/library/ruby:2.6.8-buster@sha256:e2f52bf531fd1c03910dace91aa41dc27d9b1d79a0bcacb7aa7f95e269b78d2a                                                       0.0s 
=> => sha256:e2f52bf531fd1c03910dace91aa41dc27d9b1d79a0bcacb7aa7f95e269b78d2a 1.86kB / 1.86kB                                                                                   0.0s 
=> => sha256:fa8f4da6b2c89d757bec1bad6014fb6ca2cf208cee58142e23d4770105f18459 198B / 198B                                                                                       0.3s 
=> => sha256:dfbe1b1a040271c86f8c61df06288967c07215ed4358cbcb6b60e45fd917ddad 21.50MB / 21.50MB                                                                                 6.9s 
=> => sha256:a0e92469d6e77fedb6e8fecb02a37bafb1593b64299bcbbae8f08150bd8a0fd9 176B / 176B                                                                                       0.3s 
=> => sha256:5e93372cf5ecbc0683276f56df1422cfbdbf7e0151c322e813deb9d559c8ff00 2.00kB / 2.00kB                                                                                   0.0s 
=> => sha256:9bb701ada87eda3d95677aad6b5fc57b52006ebb557af2637cb0c69c91368e49 7.29kB / 7.29kB                                                                                   0.0s 
=> => extracting sha256:fa8f4da6b2c89d757bec1bad6014fb6ca2cf208cee58142e23d4770105f18459                                                                                        0.0s 
=> => extracting sha256:dfbe1b1a040271c86f8c61df06288967c07215ed4358cbcb6b60e45fd917ddad                                                                                        0.7s 
=> => extracting sha256:a0e92469d6e77fedb6e8fecb02a37bafb1593b64299bcbbae8f08150bd8a0fd9                                                                                        0.0s 
=> [internal] load build context                                                                                                                                               10.8s 
=> => transferring context: 150.55MB                                                                                                                                           10.8s 
=> [ 2/16] RUN apt-get update -qq                                                                                                                                               4.3s 
=> [ 3/16] RUN apt-get install -y build-essential libpq-dev postgresql-client nodejs imagemagick sudo libxss1 libappindicator1 libindicator7 unzip memcached cmake pkg-config  22.4s 
=> [ 4/16] RUN adduser --shell /bin/bash --disabled-password --gecos "" consul   && adduser consul sudo   && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers                0.6s 
=> [ 5/16] RUN echo 'Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bundle/bin"' > /etc/sudoers.d/secure_path                    0.5s 
=> [ 6/16] RUN chmod 0440 /etc/sudoers.d/secure_path                                                                                                                            0.6s 
=> [ 7/16] COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh                                                                                                              0.0s 
=> [ 8/16] RUN mkdir -p /var/www/consul/tmp/pids                                                                                                                                0.6s 
=> [ 9/16] WORKDIR /var/www/consul                                                                                                                                              0.0s 
=> [10/16] COPY Gemfile Gemfile                                                                                                                                                 0.0s 
=> [11/16] COPY Gemfile.lock Gemfile.lock                                                                                                                                       0.0s 
=> [12/16] COPY Gemfile_custom Gemfile_custom                                                                                                                                   0.0s 
=> [13/16] RUN gem install bundler                                                                                                                                              1.4s 
=> ERROR [14/16] RUN bundle install --full-index                                                                                                                               22.6s 
------
> [14/16] RUN bundle install --full-index:
#19 1.547 Fetching source index from https://rails-assets.org/
#19 5.812 Fetching source index from https://rubygems.org/
#19 15.74 Resolving dependencies...................................................................................................................................................................................................................................................................................................................................................................................................................................................................
#19 22.50 Your bundle is locked to activesupport (5.2.6) from rubygems repository
#19 22.50 https://rails-assets.org/ or installed locally, but that version can no longer
#19 22.50 be found in that source. That means the author of activesupport (5.2.6) has
#19 22.50 removed it. You'll need to update your bundle to a version other than
#19 22.50 activesupport (5.2.6) that hasn't been removed in order to install.
------
executor failed running [/bin/sh -c bundle install --full-index]: exit code: 7

Expected Behavior

Expected image to be built successfully.

Steps to reproduce

  1. clone the repository
  2. Run docker build . with the following Dockerfile:
FROM ruby:2.6.8-buster

ENV DEBIAN_FRONTEND noninteractive

# Install essential Linux packages
RUN apt-get update -qq
RUN apt-get install -y build-essential libpq-dev postgresql-client nodejs imagemagick sudo libxss1 libappindicator1 libindicator7 unzip memcached cmake pkg-config shared-mime-info

# Files created inside the container repect the ownership
RUN adduser --shell /bin/bash --disabled-password --gecos "" consul \
  && adduser consul sudo \
  && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

RUN echo 'Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bundle/bin"' > /etc/sudoers.d/secure_path
RUN chmod 0440 /etc/sudoers.d/secure_path

COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh

# Define where our application will live inside the image
ENV RAILS_ROOT /var/www/consul

# Create application home. App server will need the pids dir so just create everything in one shot
RUN mkdir -p $RAILS_ROOT/tmp/pids

# Set our working directory inside the image
WORKDIR $RAILS_ROOT

# Use the Gemfiles as Docker cache markers. Always bundle before copying app src.
# (the src likely changed and we don't want to invalidate Docker's cache too early)
# http://ilikestuffblog.com/2014/01/06/how-to-skip-bundle-install-when-deploying-a-rails-app-to-docker/
COPY Gemfile Gemfile

COPY Gemfile.lock Gemfile.lock

COPY Gemfile_custom Gemfile_custom

# Prevent bundler warnings; ensure that the bundler version executed is >= that which created Gemfile.lock
RUN gem install bundler

# Finish establishing our Ruby environment
RUN bundle install --full-index

# Install Chromium for E2E integration tests
RUN apt-get update -qq && apt-get install -y chromium

# Copy the Rails application into place
COPY . .

# Define the script we want run once the container boots
# Use the "exec" form of CMD so our script shuts down gracefully on SIGTERM (i.e. `docker stop`)
# CMD [ "config/containers/app_cmd.sh" ]
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
@javierm
Copy link
Member

javierm commented Aug 24, 2021

Hi, @ProgrammingVibes 😄.

I can't reproduce this issue 🤔. It works properly on both my machine and our CI.

Maybe there was some kind of issue with rubygems at the time you executed the command 🤔. Does it still happen if you run it again? Given the steps you mention, I take it you didn't change anything in the Gemfile nor any other file, right?

@ProgrammingVibes
Copy link
Author

Made no changes to any file, just cloned, went into the consul/ folder, and built. Ran it again and hit the same issues.

Perhaps we are using docker on different environments? I am currently running it on a non-activated Windows 10. Here is my environment information (grepped out sensitive information):

OS=Windows_NT
COMMONPROGRAMFILES=C:\Program Files\Common Files
PROCESSOR_LEVEL=23
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
CommonProgramW6432=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
MSYSTEM_CARCH=x86_64
DISPLAY=needs-to-be-defined
PUBLIC=C:\Users\Public
CONFIG_SITE=/etc/config.site
EXEPATH=C:\Program Files\Git
MSYSTEM_CHOST=x86_64-w64-mingw32
PROCESSOR_ARCHITECTURE=AMD64
FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
!::=::\
SYSTEMDRIVE=C:
SYSTEMROOT=C:\Windows
PROCESSOR_IDENTIFIER=AMD64 Family 23 Model 113 Stepping 0, AuthenticAMD
MINGW_PACKAGE_PREFIX=mingw-w64-x86_64
SSH_ASKPASS=/mingw64/libexec/git-core/git-gui--askpass
TMP=/tmp
LC_CTYPE=en_US.UTF-8
TERM_PROGRAM=mintty
TERM_PROGRAM_VERSION=3.5.0
MSYSTEM_PREFIX=/mingw64
PROCESSOR_REVISION=7100
FPS_BROWSER_USER_PROFILE_STRING=Default
TMPDIR=/tmp
NUMBER_OF_PROCESSORS=12
ProgramW6432=C:\Program Files
COMSPEC=C:\Windows\system32\cmd.exe
SHELL=/usr/bin/bash
TERM=xterm
WINDIR=C:\Windows
MINGW_CHOST=x86_64-w64-mingw32
ProgramData=C:\ProgramData
SHLVL=1
PLINK_PROTOCOL=ssh
ACLOCAL_PATH=/mingw64/share/aclocal:/usr/share/aclocal
PROGRAMFILES=C:\Program Files
MANPATH=/mingw64/local/man:/mingw64/share/man:/usr/local/man:/usr/share/man:/usr/man:/share/man
ORIGINAL_TEMP=/tmp
ORIGINAL_TMP=/tmp
ALLUSERSPROFILE=C:\ProgramData
TEMP=/tmp
DriverData=C:\Windows\System32\Drivers\DriverData
MSYSTEM=MINGW64
MINGW_PREFIX=/mingw64
SESSIONNAME=Console
ProgramFiles(x86)=C:\Program Files (x86)
PS1=\[\033]0;$TITLEPREFIX:$PWD\007\]\n\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$
HOMEDRIVE=C:
PKG_CONFIG_PATH=/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig
INFOPATH=/usr/local/info:/usr/share/info:/usr/info:/share/info

@ProgrammingVibes
Copy link
Author

Not a fix, but a minor workaround:

add RUN bundle prior to RUN bundle install --full-index in the Dockerfile. At that point RUN bundle install --full-index might just be a redundancy, and the image could build successfully either way. I am just unsure if this will cause dependency issues down the line.

@ProgrammingVibes
Copy link
Author

ProgrammingVibes commented Aug 25, 2021

It's as expected, changing the dockerfile is giving me errors down the road even though it resolves build errors. It may be related to the fact that there exists no docker setup process for Windows at the moment:

https://github.com/consul/docs/blob/master/en/installation/docker.md

@javierm
Copy link
Member

javierm commented Oct 30, 2021

Hi, @ProgrammingVibes 😄. With the documentation you added, is this issue still relevant? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants