I'm trying to use ImageMagick on my Ubuntu 14.04 server for resizing an image before uploading to s3. I'm running everything inside of a docker container that's being created by Wercker. The problem is I've already installed it on the server, and installed it in the Wercker build for the docker container, yet my EasyImage (nodejs library handling the resizing) is saying
ImageMagick Not Found
EasyImage requires ImageMagick to work. Install it from http://www.imagemagick.org/script/binary-release.php.
This is the command I have in my Wercker file to install imagemagick
sudo apt-get update -y && sudo apt-get install -y imagemagick php5-imagick
I've also used
sudo apt-get update -y && sudo apt-get install -y imagemagick
, but neither seem to work. Am I missing something to get ImageMagick working inside of a docker container?
i met problem with imagemagick in docker container too. I share a part of my docker config. When i tested into docker container what's goes wrong, i see error from imagemagick about lost fonts. If you use lightweight version of smth images like linux-alpine or smth else, your images cannot have any important tools like your local machine or VM. Of course you need to install it in docker container, not in your vm on server
Install of imagemagic in docker very simple: apk --update add imagemagick
A part of my docker file. I install some important font, imagemagic work with it great. And yet it can resolve another problem, because i have this error when try to use imagemagick in docker
Stream yields empty buffer
# the first thing we specify in a Dockerfile is the base image
FROM keymetrics/pm2:latest-alpine
RUN yarn global add pm2@latest
# Install image preview generator tools
RUN apk add --no-cache file
RUN apk --update add imagemagick
# Install fonts
RUN apk --no-cache add msttcorefonts-installer fontconfig && \
update-ms-fonts && \
fc-cache -f
You need to install imagick using pecl and extension to enable imagick in php. The following command worked for me:
RUN apt-get update && apt-get install -y \
imagemagick libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick
For me, this code worked:
RUN set -ex \
&& apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS imagemagick-dev libtool \
&& export CFLAGS="$PHP_CFLAGS" CPPFLAGS="$PHP_CPPFLAGS" LDFLAGS="$PHP_LDFLAGS" \
&& pecl install imagick-3.4.3 \
&& docker-php-ext-enable imagick \
&& apk add --no-cache --virtual .imagick-runtime-deps imagemagick \
&& apk del .phpize-deps
it installs the imagick trough pecl install
then enables the php ext.
I found the solution here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With