1

I can't seem to get gem working within a Docker container that's got a ruby 2.5.1 built from source. This is my Dockerfile:

FROM ubuntu:16.04

RUN apt-get update
RUN apt-get install -y openssl
RUN apt-get install -y zlib1g-dev

#Install ruby
RUN apt-get install -y wget
RUN apt-get update
RUN apt-get install -y gcc
RUN wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.gz
RUN tar -xf ruby-2.5.1.tar.gz
RUN apt-get install make
RUN cd ruby-2.5.1 && ./configure && make && make install

If I try to issue the command gem install bundler from within a container derived from the above Dockerfile, I get:

ERROR:  While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources

How could I fix this error?

  • I've tried adding a --with-openssl-dir=$(which openssl) to the ./configure instruction, but it was to no avail.

  • If I don't issue the apt-get install -y zlib1g-dev command, the installation still succeeds, but I get an error saying that the zlib package is missing.

bsam
  • 880
  • 1
  • 8
  • 18
  • 1
    You presumably need OpenSSL header files, but it's probably much easier to just use the prebuilt [ruby:2.5.1](https://hub.docker.com/_/ruby/) image and not worry about it. – David Maze Aug 18 '18 at 21:31
  • @DavidMaze i want to have ubuntu as my container's OS. AFAIK, the prebuilt ruby images ship with debian. – bsam Aug 19 '18 at 00:41

0 Answers0