Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

digitlimit's avatar

How do I get this to work in a docker environment - missing ext-zip extension

I am stuck with these errors for days and I have tried quite a couple of Dockerfile configurations.

Versions

  • PHP version: 7.3
  • Laravel version: ^6.2
  • Package version: ^3.1

Description

Exact errors

  Problem 1
    - Installation request for phpoffice/phpspreadsheet 1.11.0 -> satisfiable by phpoffice/phpspreadsheet[1.11.0].
    - phpoffice/phpspreadsheet 1.11.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
  Problem 2
    - phpoffice/phpspreadsheet 1.11.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - maatwebsite/excel 3.1.19 requires phpoffice/phpspreadsheet ^1.10 -> satisfiable by phpoffice/phpspreadsheet[1.11.0].
    - Installation request for maatwebsite/excel 3.1.19 -> satisfiable by maatwebsite/excel[3.1.19].

  To enable extensions, verify that they are enabled in your .ini files:
    -
    - /usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-exif.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-gd.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

My Dockerfile

FROM php:7.3-fpm

# Arguments defined in docker-compose.yml
ARG user
ARG uid

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    curl \
    libpng-dev \
    libonig-dev \
    libxml2-dev

RUN apt-get update && \
     apt-get install -y \
         libzip-dev \
         && docker-php-ext-install zip

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
    chown -R $user:$user /home/$user

# Set working directory
WORKDIR /var/www

USER $user

# Run migration?

0 likes
4 replies
oranges13's avatar

Since adding zip to your Dockerfile, have you done a rebuild of the container? The error above shows that zip is not enabled on your container at the current time.

digitlimit's avatar

I didn't forget to run docker-compose build app

reans's avatar

Did you find a solution? I'm getting the same error.

Please or to participate in this conversation.