docker-alpine
docker-alpine copied to clipboard
Alpine 3.8 causes error in AWS-SDK (cannot load such file -- webrick/httputil)
Backtrace:
Traceback (most recent call last):
34: from ./bin/init:3:in `<main>'
33: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
32: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
31: from /usr/app/lib/poller.rb:4:in `<top (required)>'
30: from /usr/app/lib/poller.rb:4:in `new'
29: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-resources-2.6.18/lib/aws-sdk-resources/services/sqs/queue_poller.rb:210:in `initialize'
28: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/base.rb:101:in `new'
27: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/base.rb:213:in `build_plugins'
26: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/base.rb:170:in `plugins'
25: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/base.rb:170:in `Array'
24: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/base.rb:170:in `to_a'
23: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/plugin_list.rb:58:in `each'
22: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/plugin_list.rb:72:in `each_plugin'
21: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/plugin_list.rb:72:in `synchronize'
20: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/plugin_list.rb:73:in `block in each_plugin'
19: from /usr/lib/ruby/2.5.0/set.rb:338:in `each'
18: from /usr/lib/ruby/2.5.0/set.rb:338:in `each_key'
17: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/plugin_list.rb:59:in `block in each'
16: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/plugin_list.rb:103:in `plugin'
15: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/plugin_list.rb:133:in `require_plugin'
14: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/plugin_list.rb:133:in `each'
13: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/plugin_list.rb:134:in `block in require_plugin'
12: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/seahorse/client/plugin_list.rb:134:in `const_get'
11: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
10: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
9: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/aws-sdk-core/plugins/request_signer.rb:1:in `<top (required)>'
8: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/aws-sdk-core/plugins/request_signer.rb:2:in `<module:Aws>'
7: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/aws-sdk-core/plugins/request_signer.rb:26:in `<module:Plugins>'
6: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/aws-sdk-core/plugins/request_signer.rb:61:in `<class:RequestSigner>'
5: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/aws-sdk-core/plugins/request_signer.rb:67:in `<class:Handler>'
4: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
3: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
2: from /usr/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.6.18/lib/aws-sdk-core/signers/s3.rb:4:in `<top (required)>'
1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- webrick/httputils (LoadError)
The code that sets the app into this failure is:
Aws::SQS::QueuePoller.new(QUEUE_URL)
Dockerfile:
FROM alpine:3.8
ENV BUILD_PACKAGES curl-dev ruby-dev build-base
# Update and install base packages
RUN apk update && apk upgrade && apk add $BUILD_PACKAGES
# Install ruby and ruby-bundler
RUN apk add ruby ruby-io-console ruby-bundler
RUN mkdir /usr/app
WORKDIR /usr/app
COPY Gemfile /usr/app/
COPY Gemfile.lock /usr/app/
RUN bundle install
COPY . /usr/app
# Clean APK cache
RUN rm -rf /var/cache/apk/*
ENTRYPOINT ["./bin/init"]
Gemfile:
source 'https://rubygems.org'
gem 'aws-sdk', '~> 2'
gem 'json'
Specifying FROM alpine:3.7 fixes the issue.
Looks like Alpine linux 3.8 (using ruby 2.5) made the webrick gem an optional install. The gem is listed as a default gem which is supposed to be always available and cannot be uninstalled (https://stdgems.org/2.5.1/) but Alpine seems to have thought it should be optional.
apk add ruby-webrick
fixes the issue for me on alpine 3.8