skip to Main Content

Info:

  • OS: Ubuntu 16.04
  • Docker version: 20.10.6
  • Commit: 63fc1fd
  • Project versions:
    • Laravel 5.8.33
    • Vue 2.6.10

My Laravel docker environment stopped working today.
After several tries I finally deleted all images and tried to rebuild environemt.
I get the same error:

+ apt-get install -yqq apt-utils libzip-dev zip unzip
E: Unable to correct problems, you have held broken packages.
ERROR: Service 'php-fpm' failed to build: The command '/bin/sh -c set -xe;     apt-get update -yqq &&     pecl channel-update pecl.php.net &&     apt-get install -yqq       apt-utils       libzip-dev zip unzip &&       docker-php-ext-configure zip --with-libzip &&       docker-php-ext-install zip &&       php -m | grep -q 'zip'' returned a non-zero code: 100

enter image description here

Here is the code of my php-fpm Docker file.
Any idea what is wrong?

3

Answers


  1. did you add

    RUN apk add –no-cache php
    php7-common
    php7-fpm

    Login or Signup to reply.
  2. in Dockerfile

    you can add:

    FROM composer AS composer

    COPY . /app
    RUN rm composer.lock && composer install
    –optimize-autoloader
    –no-interaction
    –no-progress
    –ignore-platform-reqs

    RUN apk add –no-cache php
    php7-common
    php7-fpm
    php7-pdo
    php7-opcache
    php7-zip

    Login or Signup to reply.
  3. try this

    FROM composer AS composer
    
    COPY . /app
    RUN rm composer.lock && composer install 
      --optimize-autoloader 
      --no-interaction 
      --no-progress 
      --ignore-platform-reqs
    RUN chmod 777 -R storage
    
    FROM alpine:3.13
    LABEL Maintainer="Diki Rahman <[email protected]>"
    
    RUN apk add --no-cache php 
        php7-common 
        php7-fpm 
        php7-pdo 
        php7-opcache 
        php7-zip 
        php7-phar 
        php7-iconv 
        php7-cli 
        php7-curl 
        php7-openssl 
        php7-mbstring 
        php7-tokenizer 
        php7-fileinfo 
        php7-json 
        php7-xml 
        php7-xmlwriter 
        php7-simplexml 
        php7-dom 
        php7-pdo_mysql 
        php7-pdo_pgsql 
        php7-pdo_sqlite 
        php7-tokenizer 
        php7-pecl-redis 
        nginx supervisor curl
    
    COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
    COPY docker/nginx/default.conf /etc/nginx/conf.d/default.conf
    
    COPY docker/php-fpm/fpm-pool.conf /etc/php7/php-fpm.d/www.conf
    COPY docker/php/php.ini /etc/php7/conf.d/timezone.ini
    
    COPY docker/supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
    COPY docker/docker-entrypoint.sh /docker-entrypoint.sh
    
    RUN chmod +x docker-entrypoint.sh
    RUN mkdir -p /var/www/html
    RUN mkdir -p /var/www/backend
    
    RUN chown -R nginx.nginx /var/www/html && 
      chown -R nginx.nginx /run && 
      chown -R nginx.nginx /var/lib/nginx && 
      chown -R nginx.nginx /var/log/nginx
    
    WORKDIR /var/www/html
    
    COPY --chown=nginx --from=composer /app /var/www/html
    COPY --chown=nginx --from=composer /app /var/www/backend
    
    EXPOSE 8080
    
    ENTRYPOINT ["/docker-entrypoint.sh"]
    
    HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8080/fpm-ping
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search