Installation of ImageMagick on Centos7

I’m trying to instal ImageMagick on a Centos7 base image and I’m receiving errors related to depedencies. According to the ImageMagick website, the RPM is self-installing: ImageMagick RPM's are self-installing. Simply type the following command and you're ready to start using ImageMagick. Now I’m not sure if this is docker-related or not, but any help would be appreciated :).

FROM centos:7
ADD http://www.imagemagick.org/download/linux/CentOS/x86_64/ImageMagick-6.9.3-7.x86_64.rpm /tmp/ImageMagick-6.9.3-7.x86_64.rpm
RUN rpm -Uvh /tmp/ImageMagick-6.9.3-7.x86_64.rpm

Output of the build command is this:

Sending build context to Docker daemon 2.048 kB
Step 1 : FROM centos:7
7: Pulling from library/centos
fa5be2806d4c: Pull complete
ec6bd55c6a0a: Pull complete
721496b876b6: Pull complete
eb98cdc284d4: Pull complete
Digest: sha256:3cdc0670fe9130ab3741b126cfac6d7720492dd2c1c8ae033dcd77d32855bab2
Status: Downloaded newer image for centos:7
 ---> eb98cdc284d4
Step 2 : ADD http://www.imagemagick.org/download/linux/CentOS/x86_64/ImageMagick-6.9.3-7.x86_64.rpm /tmp/ImageMagick-6.9.3-7.x86_64.rpm
Downloading [==================================================>] 150.4 kB/150.4 kB
 ---> 5cc32e4cd387
Removing intermediate container 02b8c2f4aa6f
Step 3 : RUN rpm -Uvh /tmp/ImageMagick-6.9.3-7.x86_64.rpm
 ---> Running in 44e74e2ddd59
error: Failed dependencies:
	ImageMagick-libs = 6.9.3-7 is needed by ImageMagick-6.9.3-7.x86_64
	libICE.so.6()(64bit) is needed by ImageMagick-6.9.3-7.x86_64
	libMagickCore-6.Q16.so.2()(64bit) is needed by ImageMagick-6.9.3-7.x86_64
	libMagickWand-6.Q16.so.2()(64bit) is needed by ImageMagick-6.9.3-7.x86_64
	libSM.so.6()(64bit) is needed by ImageMagick-6.9.3-7.x86_64
	libX11.so.6()(64bit) is needed by ImageMagick-6.9.3-7.x86_64
	libXext.so.6()(64bit) is needed by ImageMagick-6.9.3-7.x86_64
	libXt.so.6()(64bit) is needed by ImageMagick-6.9.3-7.x86_64
	libfftw3.so.3()(64bit) is needed by ImageMagick-6.9.3-7.x86_64
	libfontconfig.so.1()(64bit) is needed by ImageMagick-6.9.3-7.x86_64
	libfreetype.so.6()(64bit) is needed by ImageMagick-6.9.3-7.x86_64
	libgomp.so.1()(64bit) is needed by ImageMagick-6.9.3-7.x86_64
	liblcms2.so.2()(64bit) is needed by ImageMagick-6.9.3-7.x86_64
	libltdl.so.7()(64bit) is needed by ImageMagick-6.9.3-7.x86_64
The command '/bin/sh -c rpm -Uvh /tmp/ImageMagick-6.9.3-7.x86
_64.rpm' returned a non-zero code: 1

So basically, what I want is:

  • the latest ImageMagick
  • in Centos7

Well, as the error messages says, there are dependencies that the rpm expects which are not present.

Is there a specific reason to use the latest RPM instead of just yum install -y imagemagick? That’d be by far the easiest solution. This gives ImageMagick 6.7.8-9 version for me on centos:latest.

If you absolutely must use the latest RPM, you probably need to yum update -y and yum install -y the listed libraries that the package assumes will be present but aren’t. I’m not 100% sure, but it’s possible the RPM expects some libraries to be around already which aren’t present in the centos image (Docker images are usually pretty barebones by default).

Thanks; however I need the latest version :(. Have managed this by creating a Dockerfile which builds latest Imagemagick from sources. Problem kind of solved, but I prefer using the official RPM though.