新建一个文件夹
mkdir dockerfiles
目录下新建Dockerfile文件(vim Dockerfile),添加以下内容
# PHP官方镜像
FROM php:7.2-fpm
# yaf 扩展
RUN pecl install yaf-3.2.2 && docker-php-ext-enable yaf
# redis 扩展
RUN pecl install redis-5.2.2 && docker-php-ext-enable redis
RUN apt-get update && apt-get install -y --no-install-recommends zlib1g-dev libmemcached-dev && rm -r /var/lib/apt/lists/*
# mongodb 扩展
RUN pecl install mongodb-1.7.1 && docker-php-ext-enable mongodb
# memcached 扩展
RUN pecl install memcached && docker-php-ext-enable memcached
制作images镜像,不要忽略后面的点(.)myphp指镜像名称,7.2-fpm是tag
docker build -t myphp:7.2-fpm .
查看镜像
docker images

添加PHP、nginx容器参照:https://www.jianshu.com/p/2be3a981e1d4
查看phpinfo()





网友评论