I have this Dockerfile
FROM ruby:2.1.5
RUN apt-get update -qq && apt-get install -y build-essential
RUN apt-get install -y libpq-dev
RUN apt-get install -y libxml2-dev libxslt1-dev
RUN apt-get install -y libqt4-webkit libqt4-dev xvfb
RUN apt-get install -y nodejs
RUN apt-get install -y imagemagick libmagickwand-dev
ENV APP_HOME /lescollectionneurs
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
ADD Gemfile* $APP_HOME/
RUN bundle install
ADD . $APP_HOME
And this gemfile:
source 'https://rubygems.org'
ruby "2.1.5"
gem "rmagick", require: 'RMagick'
When I am a user docker build .:
sudo docker build .
Sending build context to Docker daemon 567.6 MB
Sending build context to Docker daemon
Step 0 : FROM ruby:2.1.5
Step 1 : RUN apt-get update -qq && apt-get install -y build-essential
Step 2 : RUN apt-get install -y libpq-dev
Step 3 : RUN apt-get install -y libxml2-dev libxslt1-dev
Step 4 : RUN apt-get install -y libqt4-webkit libqt4-dev xvfb
Step 5 : RUN apt-get install -y nodejs
Step 6 : RUN apt-get install -y imagemagick libmagickwand-dev
Step 7 : ENV APP_HOME /lescollectionneurs
Step 8 : RUN mkdir $APP_HOME
Step 9 : WORKDIR $APP_HOME
Step 10 : ADD Gemfile* $APP_HOME/
Step 11 : RUN bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching gem metadata from https://rubygems.org/..
Fetching version metadata from https://rubygems.org/.
Resolving dependencies...
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.2. Can't find Magick-config in /usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
extconf failed, exit code 1
Gem files will remain installed in /usr/local/bundle/gems/rmagick-2.13.2 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux/2.1.0-static/rmagick-2.13.2/gem_make.out
An error occurred while installing rmagick (2.13.2), and Bundler cannot
continue.
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling.
INFO[0014] The command [/bin/sh -c bundle install] returned a non-zero code: 5
This does not work because it cannot find / usr / bin /
When I run sudo docker run -t -i lescollectionneurs /bin/bash, I can do this:
root@4b015bacf80d:/
root@4b015bacf80d:/
Magick-config MagickCore-config MagickWand-config
root@4b015bacf80d:/
Usage: Magick-config [--cflags] [--cppflags] [--exec-prefix] [--ldflags] [--libs] [--prefix] [--version]
Example: gcc `Magick-config --cflags --cppflags` -o core core.c `Magick-config --ldflags --libs`
root@4b015bacf80d:/
Fetching: rmagick-2.15.0.gem (100%)
Building native extensions. This could take a while...
Successfully installed rmagick-2.15.0
Parsing documentation for rmagick-2.15.0
Installing ri documentation for rmagick-2.15.0
Done installing documentation for rmagick after 7 seconds
1 gem installed
As you can see, I can install imagemagick by opening bash. After installing the binary file is available, and I can install rmagick.
Why doesn't the result match the docke file? How to install rmagick using a docker file?
source
share