我正在使用Dockerfile
来构建自定义ruby
图像,如下所示:
FROM debian:9
RUN apt-get update \
&& apt-get install -y \
build-essential \
gcc \
openssl \
procps \
wget \
zlib1g-dev \
&& cd /tmp \
&& wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz \
&& tar -xvzf ruby-2.0.0-p0.tar.gz \
&& ls -al \
&& cd ruby-2.0.0-p0 \
&& ./configure \
&& make \
&& make install
USER someuser
WORKDIR /home/someuser
构建完成。
事实上,在图片中:
$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
但是当我旋转图像并尝试安装bundler
$ gem install bundler
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
考虑到我已经安装了openssl
,为什么会这样?
编辑:它不是this的副本,因为(尽管我正在使用OSX)我正在编译ruby
其中一个debian:9
映像,并且在该映像(openssl
)中安装了Dockerfile
编辑:按照潜在的重复问题中的指示安装libssl-dev
也不能解决该问题:
(custom-ruby)*➣ $ docker run -it --user=root pkaramol/test-ruby-new bash
root@bde5e149ced7:/home/someuser# dpkg -l | grep -i ssl
ii libssl-dev:amd64 1.1.0j-1~deb9u1 amd64 Secure Sockets Layer toolkit - development files
ii libssl-doc 1.1.0j-1~deb9u1 all Secure Sockets Layer toolkit - development documentation
ii libssl1.1:amd64 1.1.0j-1~deb9u1 amd64 Secure Sockets Layer toolkit - shared libraries
ii openssl 1.1.0j-1~deb9u1 amd64 Secure Sockets Layer toolkit - cryptographic utility
root@bde5e149ced7:/home/someuser# gem install bundler
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass