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 thezlib
package is missing.