Security policy `PDF' in the Laravel Sail container when using Imagick

61 Views Asked by At

I would like to convert a PDF into a PNG. I would use Imagick for this. My Laravel instance runs via the Laravel Sail docker container. Unfortunately, I get an error message when using Imagick:

Attempt to perform an operation not allowed by the security policy PDF @ error/constitute.c/IsCoderAuthorized/421

To solve the problem I would have to change my PDF policy in the file /etc/ImageMagick-7/policy.xml to: <policy domain="coder" rights="read | write" pattern="PDF" />. To do this, I go into the container with docker exec -it 123abc bash. The problem now is that I don't have an editor like nano or vim in the container. My question: How can I install an editor in the container? Or is there perhaps another way, library to solve the PDF policy?

Note: I see in the docker-compose file that a Dockerfile is specified. But I don't have a Dockerfile in my directory. Would it be possible to create one and enter an apt install command?

0

There are 0 best solutions below