错误:服务“php”构建失败:构建失败

问题描述 投票:0回答:1

docker-compose.yml

version: '3.8'

services:
  database:
    image: mysql
    container_name: database
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
    volumes:
      - ./mysql:/var/lib/mysql
    ports:
      - '3306:3306'

  php-apache:
    container_name: php-apache
    build:
      context: ./php
    ports:
        - '8080:80'
    volumes:
      - ./src:/var/www/laravel_doc
      - ./apache/default.conf:/etc/apache2/sites-enabled/000-default.conf
    depends_on:
      - database

Dockerfile

FROM php:7.4-apache

RUN apt-get update && apt-get install -y libmcrypt-dev \
    mysql-client libmagickwand-dev --no-install-recommends \
    && pecl install imagick \
    && docker-php-ext-enable imagick \
WORKDIR /var/www/laravel_doc

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
php mysql laravel docker apache
1个回答
0
投票

请解决 php 最新版本的问题。

坎比奥德:

FROM php:7.4-apache

一:

FROM php:8.2-apache

请确保安装后的文件不会在 php 版本中被删除。 Ya que en mi caso tuve que reemplazar al instalacion de "iconv" y "mcrypt", eliminando la siguiente linea:

docker-php-ext-install -j$(nproc) iconv mcrypt \

Tambien (en mi caso) tuve que reemplazar:

docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \

由:

&& docker-php-ext-configure gd --with-freetype --with-jpeg \
© www.soinside.com 2019 - 2024. All rights reserved.