安装composer

docker exec -it php_1025 /bin/bash
docker exec -it php bash

#基础安装方法
curl -sS https://getcomposer.org/installer | php
mv compose.phar /usr/local/bin/composer
#方法一(一条语句)
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
#方法二
php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
php composer-setup.php
mv composer.phar /usr/local/bin/composer

#更新版本
composer selfupdate   #经常执行 保持Composer一直是最新版本哦!

docker-php-ext-install 命令

docker-php-ext-install #查看可用的安装包
docker-php-ext-install sockets #安装包
docker-php-ext-install -j$(nproc)   #直接向脚本提供系统可用的物理线程数,通常为cpu核数
#默认可用的
amqp bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter 
ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mongodb mysqli 
oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql 
phar posix pspell readline recode redis reflection session shmop simplexml snmp soap sockets sodium spl 
standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zend_test zip

安装基础插件

docker-php-ext-install opcache pdo pdo_mysql mysqli

安装redis扩展

参考 https://www.cnblogs.com/coolr/p/14762878.html
php的redis包 https://pecl.php.net/package/redis

docker exec -it php_1025 /bin/bash
curl -L -o /tmp/redis.tar https://pecl.php.net/get/redis-5.3.5.tgz
tar -zxvf /tmp/redis.tar
cd /tmp/redis-5.3.5
cp -r /tmp/redis-5.3.5 /usr/src/php/ext/redis 
cd /usr/src/php/ext/redis
docker-php-ext-install redis  
php --ri redis   或者    php -m            # 查看redis是否安装成功


#pecl安装
pecl install -o -f redis && rm -rf /tmp/pear && docker-php-ext-enable redis 
php -m

安装amqp扩展

https://blog.csdn.net/u012160319/article/details/107991828

pecl install amqp

#或者
#查看版本 https://pecl.php.net/package/amqp
curl -L -o /tmp/amqp.tar https://pecl.php.net/get/amqp-1.10.2.tgz
tar -zxvf /tmp/amqp.tar
cp -r /tmp/amqp-1.10.2 /usr/src/php/ext/amqp
cd /usr/src/php/ext/amqp
docker-php-ext-install amqp


apt-get install librabbitmq-dev
apt-get update #报错更新一下

docker-php-ext-enable  amqp

安装zip扩展

安装zip扩展所需的依赖扩展
apt-get update && apt-get install -y zlib1g-dev && apt-get install -y libzip-dev

docker-php-ext-install zip

安装mongodb扩展

curl -L -o /tmp/mongodb.tar  https://pecl.php.net/get/mongodb-1.12.1.tgz
tar -zxvf /tmp/mongodb.tar
cp -r /tmp/mongodb-1.12.1 /usr/src/php/ext/mongodb
rm -rf /tmp/mongodb-1.12.1
cd /usr/src/php/ext/mongodb
docker-php-ext-install mongodb

安装gd

#apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev
#docker-php-ext-install gd
#gd2安装 包含jpeg,webp支持
apt-get install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev libmcrypt-dev  libjpeg62-turbo-dev \
  && docker-php-source extract \
  && cd /usr/src/php/ext/gd  \
  && docker-php-ext-configure gd --with-webp-dir=/usr/include/webp --with-jpeg-dir=/usr/include --with-png-dir=/usr/include --with-freetype-dir=/usr/include/freetype2   \
  && docker-php-ext-install gd

安装zip

apt-get update  
apt-get install -y zlib1g-dev libzip-dev
docker-php-ext-install zip

安装bcmath

docker-php-ext-install bcmath
docker-php-ext-install -j$(nproc) bcmath

安装soap

apt-get install libxml2-dev
#centos安装 yum install libxml2-devel
docker-php-ext-install soap