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 dependency issue with ruby #47

Open
keith-minnig opened this issue Oct 15, 2021 · 0 comments
Open

Docker dependency issue with ruby #47

keith-minnig opened this issue Oct 15, 2021 · 0 comments

Comments

@keith-minnig
Copy link

Building the docker container will fail due to unresolved ruby versions.

error:

% docker build -t better-chef-rundeck .
[+] Building 16.1s (8/10)
 => [internal] load build definition from Dockerfile                                                                        0.0s
 => => transferring dockerfile: 636B                                                                                        0.0s
 => [internal] load .dockerignore                                                                                           0.0s
 => => transferring context: 2B                                                                                             0.0s
 => [internal] load metadata for docker.io/phusion/passenger-ruby21:latest                                                  1.8s
 => [1/7] FROM docker.io/phusion/passenger-ruby21@sha256:e09f5860b2bba8bc5813dd8fa0b894a8320ef411bf1e15a621f7782252569203   0.0s
 => CACHED [2/7] WORKDIR /home/app                                                                                          0.0s
 => CACHED [3/7] RUN git clone https://github.com/atheiman/better-chef-rundeck                                              0.0s
 => CACHED [4/7] WORKDIR /home/app/better-chef-rundeck                                                                      0.0s
 => ERROR [5/7] RUN bash -c 'sed -i"" -e "/passenger/s/~> 5.0/= $(passenger --version | grep -o '5.*')/" Gemfile' &&       14.2s
------
 > [5/7] RUN bash -c 'sed -i"" -e "/passenger/s/~> 5.0/= $(passenger --version | grep -o '5.*')/" Gemfile' &&     cat Gemfile && bundle update passenger &&     bundle install:
#8 0.580 source 'https://rubygems.org'
#8 0.580
#8 0.580 gem 'chef'
#8 0.580 gem 'passenger', require: 'phusion_passenger/rack_handler'
#8 0.580 gem 'sinatra'
#8 0.580
#8 0.580 group :development do
#8 0.580   gem 'chef-zero'
#8 0.580   gem 'rack-test'
#8 0.580   gem 'rubocop'
#8 0.580   gem 'sinatra-contrib'
#8 0.580 end
#8 5.320 Fetching gem metadata from https://rubygems.org/........
#8 13.87 Fetching gem metadata from https://rubygems.org/.
#8 13.92 Resolving dependencies...
#8 14.08 Bundler could not find compatible versions for gem "ruby":
#8 14.08   In Gemfile:
#8 14.08     ruby
#8 14.08
#8 14.08     chef was resolved to 13.6.4, which depends on
#8 14.08       bundler (>= 1.10) was resolved to 1.16.3, which depends on
#8 14.08         ruby (>= 1.8.7)
#8 14.08
#8 14.08     sinatra was resolved to 2.0.0, which depends on
#8 14.08       rack (~> 2.0) was resolved to 2.1.4, which depends on
#8 14.08         ruby (>= 2.2.2)
------
executor failed running [/bin/sh -c bash -c 'sed -i"" -e "/passenger/s/~> 5.0/= $(passenger --version | grep -o '5.*')/" Gemfile' &&     cat Gemfile && bundle update passenger &&     bundle install]: exit code: 6

However, running bundle update across all gems, rather than only passenger, lets it complete (and run) fine:

diff:

 % git diff
diff --git a/Dockerfile b/Dockerfile
index 9b30353..4e3a5aa 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -5,7 +5,7 @@ WORKDIR /home/app
 RUN git clone https://github.com/atheiman/better-chef-rundeck
 WORKDIR /home/app/better-chef-rundeck
 RUN bash -c 'sed -i"" -e "/passenger/s/~> 5.0/= $(passenger --version | grep -o '5.*')/" Gemfile' && \
-    cat Gemfile && bundle update passenger && \
+    cat Gemfile && bundle update && \
     bundle install

 USER root

result:

 % docker build -t better-chef-rundeck .
[+] Building 0.9s (11/11) FINISHED
 => [internal] load build definition from Dockerfile                                                                        0.0s
 => => transferring dockerfile: 626B                                                                                        0.0s
 => [internal] load .dockerignore                                                                                           0.0s
 => => transferring context: 2B                                                                                             0.0s
 => [internal] load metadata for docker.io/phusion/passenger-ruby21:latest                                                  0.8s
 => [1/7] FROM docker.io/phusion/passenger-ruby21@sha256:e09f5860b2bba8bc5813dd8fa0b894a8320ef411bf1e15a621f7782252569203   0.0s
 => CACHED [2/7] WORKDIR /home/app                                                                                          0.0s
 => CACHED [3/7] RUN git clone https://github.com/atheiman/better-chef-rundeck                                              0.0s
 => CACHED [4/7] WORKDIR /home/app/better-chef-rundeck                                                                      0.0s
 => CACHED [5/7] RUN bash -c 'sed -i"" -e "/passenger/s/~> 5.0/= $(passenger --version | grep -o '5.*')/" Gemfile' &&       0.0s
 => CACHED [6/7] RUN echo 'server {\n  listen 80;\n  root /home/app/better-chef-rundeck/public;\n  passenger_enabled on;\n  0.0s
 => CACHED [7/7] RUN rm /etc/nginx/sites-enabled/default && rm /etc/service/nginx/down                                      0.0s
 => exporting to image                                                                                                      0.0s
 => => exporting layers                                                                                                     0.0s
 => => writing image sha256:c4820b7354ac7c2a8691060cb0f1ed29bcffd4de874a078a7fed5c58fb82c9cc                                0.0s
 => => naming to docker.io/library/better-chef-rundeck                                                                      0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them

That's probably not the best solution moving forward, but it'll unblock anyone that wants to try it out.

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

No branches or pull requests

1 participant