dooman87 / imagemagick-docker

Running the latest version of imagemagick inside container
https://hub.docker.com/r/dpokidov/imagemagick
MIT License
95 stars 25 forks source link

Can't run while sharing volumes #9

Closed Pierstoval closed 3 years ago

Pierstoval commented 3 years ago

Hello, I'm working on ImageMagickPHP and I'd like to use your Docker image to simplify ImageMagick's installation for testing purposes.

So far, your image provides everything I need, however I can't really run it from my scripts.

I tested locally on a Ubuntu 20.04 WSL2 setup.

For the record, I also have a local installation of ImageMagick 7.0.11-6 Q16 x86_64.

Here is what I do to reproduce:

First, create a docker_entrypoint.sh file containing only this:

#!/bin/sh
sh -c $@

Then run this:

docker run \
    --rm \
    --volume `pwd`:`pwd` \
    --workdir=`pwd` \
    --entrypoint="`pwd`/docker_entrypoint.sh" \
    dpokidov/imagemagick:latest \
    magick \
    -version

What I'd like to see is this:

Version: ImageMagick 7.0.11-2 Q16 x86_64 2021-02-25 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5)
Delegates (built-in): heic jng jpeg png webp xml zlib

But instead, I see this:

Error: Invalid argument or not enough arguments

Usage: magick tool [ {option} | {image} ... ] {output_image}
Usage: magick [ {option} | {image} ... ] {output_image}
       magick [ {option} | {image} ... ] -script {filename} [ {script_args} ...]
       magick -help | -version | -usage | -list {option}

However, this works when I execute a command from inside the container, like this:

$ docker run \
    --rm \
    -it \
    --volume `pwd`:`pwd` \
    --workdir=`pwd` \
    --entrypoint="`pwd`/docker_entrypoint.sh" \
    dpokidov/imagemagick:latest \
    bash
root@8e1a1289fd8f:/var/www/ImageMagickPHP# magick -version
Version: ImageMagick 7.0.11-2 Q16 x86_64 2021-02-25 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5)
Delegates (built-in): heic jng jpeg png webp xml zlib

Any idea on what I'm missing? 🤔

dooman87 commented 3 years ago

Hi Alex,

I think the problem might be in docker_entrypoint script. It gave me the same result as you posted outside of docker. That worked for me:

#!/bin/bash
"$@"
Pierstoval commented 3 years ago

Works like a charm, thanks a lot!