Public Repository

Last pushed: a year ago
Short Description
Short description is empty for this repo.
Full Description

Full description is empty for this repo.

Docker Pull Command
Owner
rickfast

Comments (2)
tarundocker031
a day ago

FROM alpine

#RUN apt-get update && apt-get install ruby-full
RUN apk update && apk add ruby && apk add ruby-dev

Dependencies to make json gem

RUN apk add gcc && apk add make && apk add musl-dev
RUN gem install json --no-ri --no-rdoc
RUN gem install sinatra --no-ri --no-rdoc
RUN gem install redis --no-ri --no-rdoc
ADD counter.rb counter.rb
EXPOSE 4567
ENTRYPOINT ["ruby", "counter.rb"]

pjaros
4 days ago

Hello

I'm going through your course "Learning Path: Delivering Applications with Docker". I've run into a problem while trying the counter.rb example. It seems sinatra 2.0.0 refuses to run your example. It exits with the following error:
$ docker run -p 4567:4567 --link redis:redis pjaros/counter
/usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- json (LoadError) from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /usr/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/session/cookie.rb:6:in <top (required)>' from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/lib/ruby/gems/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1773:in<class:Base>'
from /usr/lib/ruby/gems/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:894:in <module:Sinatra>' from /usr/lib/ruby/gems/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:22:in<top (required)>'
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /usr/lib/ruby/gems/2.4.0/gems/sinatra-2.0.0/lib/sinatra/main.rb:1:in <top (required)>' from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/lib/ruby/gems/2.4.0/gems/sinatra-2.0.0/lib/sinatra.rb:1:in<top (required)>'
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in require' from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:inrescue in require'
from /usr/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in require' from counter.rb:1:in<main>'

I was able to run your example after I modified the Dockerfile directing gem to install sinatra with the version 1.4.7. Now it looks like this:
$ cat Dockerfile
FROM alpine
MAINTAINER pjaros jaros.paul@gmail.com
RUN apk update && apk add ruby
RUN gem install sinatra -v 1.4.7 --no-ri --no-rdoc
RUN gem install redis --no-ri --no-rdoc
ADD counter.rb counter.rb
EXPOSE 4567
ENTRYPOINT ["ruby", "counter.rb"]

Have a nice day a thank you for your wonderful tutorial. Paul Jaros