Laradockでphp-fpmのビルドが失敗する(ERROR: Service 'php-fpm' failed to build:)
Laravelでプロジェクト作るぞー。
$ git clone https://github.com/Laradock/laradock.git $ cd laradock $ cp env-example .env $ docker-compose up -d --build workspace nginx postgres php-fpm Creating network "laradock_frontend" with driver "bridge" Creating network "laradock_backend" with driver "bridge" Creating network "laradock_default" with the default driver Building postgres Step 1/4 : FROM postgres:alpine ---> 5df4f9af771f Step 2/4 : LABEL maintainer="Ben M <git@bmagg.com>" ---> Using cache ---> cbd40267a5dc Step 3/4 : CMD ["postgres"] ---> Using cache ---> fce54f198ca3 Step 4/4 : EXPOSE 5432 ---> Using cache ---> 9e99ef40b306
ヨシ…。
E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/i/imagemagick/imagemagick-6-common_6.9.7.4+dfsg-11+deb9u5_all.deb 404 Not Found E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/i/imagemagick/libmagickcore-6-arch-config_6.9.7.4+dfsg-11+deb9u5_amd64.deb 404 Not Found E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/i/imagemagick/libmagickcore-6-headers_6.9.7.4+dfsg-11+deb9u5_all.deb 404 Not Found E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/i/imagemagick/libmagickcore-6.q16-3_6.9.7.4+dfsg-11+deb9u5_amd64.deb 404 Not Found E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/i/imagemagick/libmagickwand-6-headers_6.9.7.4+dfsg-11+deb9u5_all.deb 404 Not Found E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/i/imagemagick/libmagickwand-6.q16-3_6.9.7.4+dfsg-11+deb9u5_amd64.deb 404 Not Found E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/i/imagemagick/libmagickcore-6.q16-3-extra_6.9.7.4+dfsg-11+deb9u5_amd64.deb 404 Not Found E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/p/python3.5/libpython3.5-minimal_3.5.3-1_amd64.deb 404 Not Found E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/p/python3.5/python3.5-minimal_3.5.3-1_amd64.deb 404 Not Found E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/p/python3.5/python3.5_3.5.3-1_amd64.deb 404 Not Found E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/i/imagemagick/libmagickcore-6.q16-dev_6.9.7.4+dfsg-11+deb9u5_amd64.deb 404 Not Found E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/i/imagemagick/libmagickwand-6.q16-dev_6.9.7.4+dfsg-11+deb9u5_amd64.deb 404 Not FoundFetched 70.6 MB in 7s (9688 kB/s) E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/i/imagemagick/libmagickwand-dev_6.9.7.4+dfsg-11+deb9u5_all.deb 404 Not Found E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/g/ghostscript/libgs9-common_9.20~dfsg-3.2+deb9u4_all.deb 404 Not Found E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/g/ghostscript/libgs9_9.20~dfsg-3.2+deb9u4_amd64.deb 404 Not Found E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/g/ghostscript/ghostscript_9.20~dfsg-3.2+deb9u4_amd64.deb 404 Not Found E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/i/imagemagick/imagemagick-6.q16_6.9.7.4+dfsg-11+deb9u5_amd64.deb 404 Not Found E: Failed to fetch http://security-cdn.debian.org/pool/updates/main/i/imagemagick/imagemagick_6.9.7.4+dfsg-11+deb9u5_amd64.deb 404 Not Found 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 -y libmagickwand-dev imagemagick && pecl install imagick && docker-php-ext-enable imagick ;fi' returned a non-zero code: 100
ヨシ…。
前使った時は出てなかったんだけどな…。
さすが GitHub
…解決済みやで。
./laradock/php-fpm/Dockerfile
の 485行目
に下記のような記述がある。
########################################################################### # ImageMagick: ########################################################################### USER root ARG INSTALL_IMAGEMAGICK=false RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \ apt-get install -y libmagickwand-dev imagemagick && \ pecl install imagick && \ docker-php-ext-enable imagick \ ;fi
これを下記のように変更する。
########################################################################### # ImageMagick: ########################################################################### USER root ARG INSTALL_IMAGEMAGICK=false RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \ apt-get update && \ apt-get install -y libmagickwand-dev imagemagick && \ pecl install imagick && \ docker-php-ext-enable imagick \ ;fi
apt-get update && \
が追加されている。
頼む…!
$ docker-compose up -d --build workspace nginx postgres php-fpm ... ... ... Successfully built ee1a7d326193 Successfully tagged laradock_nginx:latest Creating laradock_docker-in-docker_1 ... done Creating laradock_postgres_1 ... done Creating laradock_workspace_1 ... done Creating laradock_php-fpm_1 ... done Creating laradock_nginx_1 ... done $
ヨシ!
さらに続けて Laravel
プロジェクトをついでに作成する…。
laradock/.env
の 8行目
辺りの APP_CODE_PATH_HOST=../
を APP_CODE_PATH_HOST=../app
などに変更して、、、
$ docker-compose exec workspace composer create-project "laravel/laravel=5.7.*" app Do not run Composer as root/super user! See https://getcomposer.org/root for details Installing laravel/laravel (v5.7.19) - Installing laravel/laravel (v5.7.19): Downloading (100%) Created project in app > @php -r "file_exists('.env') || copy('.env.example', '.env');" Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 86 installs, 0 updates, 0 removals - Installing symfony/polyfill-ctype (v1.10.0): Downloading (100%) - Installing vlucas/phpdotenv (v2.6.1): Downloading (100%) - Installing symfony/css-selector (v4.2.2): Downloading (100%) - Installing tijsverkoyen/css-to-inline-styles (2.2.1): Downloading (100%) ... ... ... Writing lock file Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi Discovered Package: beyondcode/laravel-dump-server Discovered Package: fideloper/proxy Discovered Package: laravel/nexmo-notification-channel Discovered Package: laravel/slack-notification-channel Discovered Package: laravel/tinker Discovered Package: nesbot/carbon Discovered Package: nunomaduro/collision Package manifest generated successfully. > @php artisan key:generate --ansi Application key set successfully. $
そして localhost
にアクセス…!
…。
ビルドした後 .env
変更してもだめってことですね。
再度 docker-compose up -d --build workspace nginx postgres php-fpm
を実行して…。
ヨシ!