Home > Mobile >  Difference between apk add and docker-php-ext-install in php install?
Difference between apk add and docker-php-ext-install in php install?

Time:03-04

When I install php from aline, I use the form php-something.

Taking gd as an example, I install php8-gd using RUN apk add php8-gd

But I also saw an example using docker-php-ext-install .

For example, RUN docker-php-ext-install gd

This is not only gd, but also mysqli, bcmath, etc.

How are the two commands different?

CodePudding user response:

apk downloads pre-built binaries from the Alpine Linux repository.

docker-php-ext-install unpacks the source code of the extension and compiles it. This can be used with other base images, not just Alpine

Both are reasonable choices, but you need to choose one and stick with it. You cannot mix and match the commands, because it is highly likely you will end up with either broken software or duplicate software in your docker container.

  •  Tags:  
  • php
  • Related