我在docker下运行laravel应用程序,我想通过添加libmagickwand-dev lib来添加image magick支持,但出现错误:
而且我在运行docker-compose up -d --build时遇到错误:
...
Step 7/9 : RUN docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif && a2enmod rewrite
---> Using cache
---> 57b5ffd40a2f
Step 8/9 : RUN docker-php-ext-install libmagickwand
---> Running in 5066ebf866a8
error: /usr/src/php/ext/libmagickwand does not exist
usage: /usr/local/bin/docker-php-ext-install [-jN] [--ini-name file.ini] ext-name [ext-name ...]
ie: /usr/local/bin/docker-php-ext-install gd mysqli
/usr/local/bin/docker-php-ext-install pdo pdo_mysql
/usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop
if custom ./configure arguments are necessary, see docker-php-ext-configure
Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zend_test zip
Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.
ERROR: Service 'web' failed to build: The command '/bin/sh -c docker-php-ext-install libmagickwand' returned a non-zero code: 1
在__DOCKER / web / Dockerfile.yml中:
In FROM php:7.3-apache
RUN apt-get update && \
apt-get install -y \
python \
libfreetype6-dev \
libwebp-dev \
libjpeg62-turbo-dev \
libpng-dev \
libzip-dev \
nano \
mc \
git-core \
libmagickwand-dev \
curl \
...
RUN npm install cross-env
RUN npm install -g yarn
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/ --with-jpeg-dir=/usr/include/
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif \
&& a2enmod rewrite
# RUN install-php-extensions imagick
RUN docker-php-ext-install libmagickwand
COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
我不确定,但是在网上搜索后发现,如果从php:7.3-apache安装了docker,则不支持image magick。是这样吗?如何在我的项目中添加图片魔术?
谢谢!