docker - Docker + ImageMagick:无法直接在已安装的驱动器上处理文件
问题描述
我已经从 ubuntu:18.04创建了一个 docker 映像,并且我已经安装了ImageMagick。该程序只能转换 docker 存储上的文件,我不知道为什么(我在 windows 上)。
我做了以下事情:
# Running container
docker run -it -v c:/path/to/files:/data/ myimage
# Running imagemagick on files in data
magick -density 300 /data/myinput.pdf -quality 300 /data/myoutput.png
# Error message
Error: /undefinedfilename in (/tmp/magick-86JJbaxmanPmtT)
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:965/1684(ro)(G)-- --dict:0/20(G)-- --dict:78/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 9.26: Unrecoverable error, exit code 1
magick: FailedToExecuteCommand `'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r300x300' '-sOutputFile=/tmp/magick-86AnWywQtp36Zc%d' '-f/tmp/magick-86UR2ooTLLxHe3' '-f/tmp/magick-86JJbaxmanPmtT'' (1) @ error/pdf.c/InvokePDFDelegate/290.
但是,如果我将文件复制到 docker 映像,一切运行正常:
# Copying file to docker
mkdir data2
cp /data/myinput.pdf /data2/myinput.pdf
# Running imagemagick on file in data2
magick -density 300 /data2/myinput.pdf -quality 300 /data2/myoutput.png
有什么办法可以避免来回复制数据?您对我为什么会收到这些错误有任何建议吗?
解决方案
推荐阅读
- graphql - NestJS 问题:schema.gql 文件的目的仅仅是为了促进从“代码优先”到“模式优先”开发的过渡吗?
- angular - 如何从孩子导航到父母的兄弟姐妹?
- firebase - 使用用户属性的 Firebase FCM 仪表板
- javascript - 为什么 __proto__ 周围的方括号使其在对象中可枚举
- javascript - Android和Windows上的Javascript图像宽度不同
- python - 烧瓶 - 缺少所需的文件
- logging - Istio/Envoy 访问日志到持久卷
- spring-boot - 相对路径在 soring-boot application.yml 中不起作用
- linux - 如何让我的 Rflink (Arduino Mega) 端口显示在我的 Raspberry pi 3 上的 /dev 中?
- optimization - F# 和 ILNumerics