ADITI singh
ADITI singh

Reputation: 21

Install GD extension in php8 from alpine 3.13

I have added the following code in my Dockerfile

RUN echo -e "http://nl.alpinelinux.org/alpine/v3.13/main\nhttp://nl.alpinelinux.org/alpine/v3.13/community" > /etc/apk/repositories;
RUN apk add --no-cache gd;

I ran the command

docker-compose build

The build was successful, but when I restart my docker php8 image I still get the error - No GD module found.

I have enabled the GD extension in my php.ini file
but I get this error

Error After enabling GD extension

Upvotes: 2

Views: 13979

Answers (3)

Dale C. Anderson
Dale C. Anderson

Reputation: 2460

docker-php-ext-install has been replaced by install-php-extensions.

If you don't already have the utility in your dockerfile, add it with

ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

and then

RUN install-php-extensions gd

Upvotes: 0

Momen
Momen

Reputation: 45

I faced error with GD extension installation. The Alpine version of PHP requires some additional packages to be installed before you can successfully configure and install GD extension.

Here's how I ensured that the GD extension installs correctly:

# Install system dependencies
RUN apk add --no-cache --update \
    curl \
    openssl \
    libpng-dev \
    libjpeg-turbo-dev \
    freetype-dev \
    libzip-dev \
    unzip

# Install the GD extension 
RUN docker-php-ext-configure gd --with-freetype --with-jpeg && docker-php-ext-install gd

Upvotes: 0

iqbal
iqbal

Reputation: 59

following this answer install gd from dockerfile

RUN docker-php-ext-install gd 

https://github.com/rhamdeew/docker-php-8-fpm-alpine/blob/master/Dockerfile

Upvotes: 5

Related Questions