Задать вопрос

Почему получаю ошибку exit code 100 при docker compose build?

Почему получаю ошибку exit code 100 при docker compose build?

ARG PHP_VERSION
ARG BASE_IMAGE_TAG_PREFIX=latest
FROM php:${PHP_VERSION}-fpm

# SET WORKING DIRECTORY
WORKDIR /var/www

USER root

# INSTALL DEPENDENCIES
RUN apt-get update && apt-get install -y \
    git \
    curl \
    libzip-dev \
    libpng-dev \
    liboning-dev \
    libxml2-dev \
    zip \
    unzip \

ARG INSTALL_XDEBUG=false

RUN if [ ${INSTALL_XDEBUG} = true ]; then \
    pecl install xdebug \
;fi

# CLEAR CACHE
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# INSTALL EXTENSIONS
RUN docker-php-ext-install soap
RUN docker-php-ext-install pdo_mysql zip exif pcntl

RUN if [ ${INSTALL_XDEBUG} = true ]; then \
    docker-php-ext-enable xdebug \
;fi

RUN docker-php-ext-configure gd
RUN docker-php-ext-install gd

ARG APP_ENV=production
RUN mv "$PHP_INI_DIR/php.ini-${APP_ENV}" "$PHP_INI_DIR/php.ini"

RUN sed -i "s|pm.max_children = 5|pm.max_children = 300|g" /usr/local/etc/php-fpm.d/www.conf
RUN sed -i "s|pm.start_servers = 2|pm.start_servers = 3|g" /usr/local/etc/php-fpm.d/www.conf
RUN sed -i "s|pm.min_spare_servers = 1|pm.min_spare_servers = 3|g" /usr/local/etc/php-fpm.d/www.conf
RUN sed -i "s|pm.max_spare_servers = 3|pm.max_spare_servers = 6|g" /usr/local/etc/php-fpm.d/www.conf

# IMAGEMAGICK
USER root
ARG INSTALL_IMAGEMAGICK=false
ARG IMAGEMAGICK_VERSION=false
ENV IMAGEMAGICK_VERSION ${IMAGEMAGICK_VERSION}

RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \
    apt-get update && apt-get install -y libimagemagick-dev \
    && pecl install imagick \
    && docker-php-ext-enable imagick \
;fi

# PHP REDIS EXTENSION
ARG INSTALL_PHPREDIS=false

RUN if [ ${INSTALL_PHPREDIS} = true ]; then \
    if [ ${php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
        pecl install -o -f redis-4.3.0; \
    else \
        pecl install -o -f redis; \
    fi\
    && rm -rf /tmp/pear \
    && docker-php-ext-enable redis \
;fi

# NEW RELIC FOR PHP
ARG NEW_RELIC=${NEW_RELIC}
ARG NEW_RELIC_KEY=${NEW_RELIC_KEY}
ARG NEW_RELIC_APP_NAME=${NEW_RELIC_APP_NAME}

RUN if [ ${NEW_RELIC} = true ]; then \
    curl -L http://download.newrelic.com/php_agent/release/newrelic-php5-9.18.1.303-linux.tar.gz | tar -C /tmp -zx && \
    export NR_INSTALL_USE_CP_NOT_LN=1 && \
    export NR_INSTALL_SILENT=1 && \
    /tmp/newrelic-php5-*/newrelic-install install && \
    rm -rf /tmp/newrelic-php5-* /tmp/nrinstall* && \
    sed -i \
    -e 's/"REPLACE_WITH_REAL_KEY"/"'${NEW_RELIC_KEY}'"/' \
    -e 's/newrelic.appname = "PHP Application"/newrelic.appname = "'${NEW_RELIC_APP_NAME}'"/' \
    -e 's/;newrelic.daemon.app_connect_timeout =.*/newrelic.daemon.app_connect_timeout=15s/' \
    -e 's/;newrelic.daemon.start_timeout =.*/newrelic.daemon.start_timeout=5s/' \
    -e 's/;newrelic.daemon.address =.*/newrelic.daemon.address=newrelic:31339/' \
    /usr/local/etc/php/conf.d/newrelic.ini \
;fi

# ADD USER FOR LARAVEL APPLICATION
RUN groupadd -g 1000 www
RUN useradd -u 1000 -ms /bin/bash -g www www

# COPY EXISTING APPLICATION DIRECTORY permissions
COPY --chown=www:www . /var/www

# CHANGE CURRENT USER TO WWW
USER www

# EXPOSE PORT 9000 and start php-fpm server
ARG NGINX_PHP_UPSTREAM_PORT=9000

EXPOSE ${NGINX_PHP_UPSTREAM_PORT}
CMD ["php-fpm"]


version: '3.8'

services:
  # PHP Service
  backend:
    build:
      context: .
      dockerfile: backend_dockerfile
      args:
        - APP_ENV=${APP_ENV}
        - BASE_IMAGE_TAG_PREFIX=${PHP_FPM_BASE_IMAGE_TAG_PREFIX}
        - PHP_VERSION=${PHP_VERSION}
        - INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG}
        - INSTALL_XSL=${PHP_FPM_INSTALL_XSL}
        - INSTALL_PHPREDIS=${PHP_FPM_INSTALL_PHPREDIS}
        - NGINX_PHP_UPSTREAM_PORT=${NGINX_PHP_UPSTREAM_PORT}
        - INSTALL_IMAGEMAGICK=${PHP_FPM_INSTALL_IMAGEMAGICK}
        - NEW_RELIC=${NEW_RELIC}
        - NEW_RELIC_KEY=${NEW_RELIC_KEY}
        - NEW_RELIC_APP=${NEW_RELIC_APP_NAME}
        - PUID=${PHP_FPM_PUID}
        - PGID=${PHP_FPM_PGID}
        - INSTALL_DOCKER_CLIENT=${PHP_FPM_INSTALL_DOCKER_CLIENT}
        - http_proxy
        - https_proxy
        - no_proxy
#    image: github.com
    container_name: hte_backend
    restart: unless-stopped
    tty: true
    environment:
      SERVICE_NAME: backend
    working_dir: /var/www
    volumes:
      - ${BACKEND_CODE_PATH_HOST}:${BACKEND_CODE_PATH_CONTAINER}
      - ./server/php/php-${PHP_VERSION}-${APP_ENV}.ini:/usr/local/etc/php/php.ini
    networks:
      - app-network


Ошибка
ERROR: failed to solve: executor failed running [/bin/sh -c apt-get update && apt-get install -y     curl     libzip-dev     libpng-dev     liboning-dev     libxml2-dev     zip     unzip ARG INSTALL_XDEBUG=false]: exit code: 100
ERROR: Service 'backend' failed to build : Build failed
  • Вопрос задан
  • 3406 просмотров
Подписаться 1 Простой 1 комментарий
Решения вопроса 1
@IgorOhrimenko
1. Не указана версия php, предположу, что 7.4, тогда в дистрибутиве контейнера 7.4 нет пакета liboning-dev
2. После unzip лишний /.
unzip \

ARG INSTALL_XDEBUG=false

3. Фигурная скобочка вместо круглой:
if [ ${php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \


После исправления и сборки контейнер fpm запускается.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы