0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Laradock】ERROR: Service 'php-fpm' failed to buildの解決方法

Last updated at Posted at 2023-02-15

Laradockを使用して環境構築する際にエラーが出たので、その内容と解決方法をメモしておきます。

エラー内容

Laradockの.envファイルを作成し、以下のコマンドを実行したところ…

$ cd laradock
$ sudo docker-compose up -d --build nginx mysql workspace

以下のエラーが出ました。

E: Failed to fetch http://deb.debian.org/debian/pool/main/o/openexr/libopenexr25_2.5.4-2_amd64.deb  404  Not Found [IP: 151.101.110.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/o/openexr/libopenexr-dev_2.5.4-2_amd64.deb  404  Not Found [IP: 151.101.110.132 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
ERROR: Service 'php-fpm' failed to build: The command '/bin/sh -c if [ ${INSTALL_IMAGEMAGICK} = true ]; then     apt-get install -yqq libmagickwand-dev imagemagick &&     if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then       cd /tmp &&       if [ ${IMAGEMAGICK_VERSION} = "latest" ]; then         git clone https://github.com/Imagick/imagick;       else         git clone --branch ${IMAGEMAGICK_VERSION} https://github.com/Imagick/imagick;       fi &&       cd imagick &&       phpize &&       ./configure &&       make &&       make install &&       rm -r /tmp/imagick;     else       pecl install imagick;     fi &&     docker-php-ext-enable imagick;     php -m | grep -q 'imagick' ;fi' returned a non-zero code: 1

解決方法

laradock/php-fpm/Dockerfileapt-get update && \を追記したら、無事ビルドできました(RUN if…の一行下)

laradock\php-fpm\Dockerfile
###########################################################################
# ImageMagick:
###########################################################################

USER root

ARG INSTALL_IMAGEMAGICK=false
ARG IMAGEMAGICK_VERSION=latest
ENV IMAGEMAGICK_VERSION ${IMAGEMAGICK_VERSION}

RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \
    apt-get update && \
    apt-get install -yqq libmagickwand-dev imagemagick && \
    if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \
      cd /tmp && \
      if [ ${IMAGEMAGICK_VERSION} = "latest" ]; then \
        git clone https://github.com/Imagick/imagick; \
      else \
        git clone --branch ${IMAGEMAGICK_VERSION} https://github.com/Imagick/imagick; \
      fi && \
      cd imagick && \
      phpize && \
      ./configure && \
      make && \
      make install && \
      rm -r /tmp/imagick; \
    else \
      pecl install imagick; \
    fi && \
    docker-php-ext-enable imagick; \
    php -m | grep -q 'imagick' \
;fi

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?