docker-compose 搭建php-fpm报错
创建的项目目录结构
|-- docker-compose.yml
|-- nginx
| |-- conf.d
| |-- logs
| \`-- nginx.conf
|-- php
| \`-- Dockerfile
| |-- php-fpm.d
| \`-- www.conf
| \`-- php.ini
|-- mysql
| \`-- data
|-- www
\`-- index.html
docker-compose.yml 配置
version: '3.0'
services:
nginx:
restart: always
image: nginx:latest
container_name: my-nginx
ports:
- 80:80
- 443:443
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d:ro
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/logs:/var/log/nginx:rw
- ./www:/usr/share/nginx/html:rw
- /etc/letsencrypt:/etc/letsencrypt
networks:
- front
phpfpm:
build: ./php
container_name: my-php
ports:
- 9000:9000
volumes:
- ./www:/var/www/html:rw
- ./php/php.ini:/usr/local/etc/php/php.ini:ro
- ./php/php-fpm.d/www.conf:/usr/local/etc/php-fpm.d/www.conf:rw
- ./php/log:/var/log:rw
networks:
- front
- backend
mysql:
image: mysql:5.7.26
container_name: my-mysql
ports:
- 3306:3306
volumes:
- ./mysql/data/:/var/lib/mysql/
environment:
MYSQL_ROOT_PASSWORD : wq540074./
networks:
front:
backend:
php的Dockerfile配置
FROM php:7.2.9-fpm
# Install any custom system requirements here
RUN apt-get update \
apt-get upgrade \
&& apt-get install -y --no-install-recommends \
libicu-dev \
libmemcached-dev \
libz-dev \
libpq-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
libssl-dev \
libmcrypt-dev \
libxml2-dev \
libbz2-dev \
libjpeg62-turbo-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install various PHP extensions
RUN docker-php-ext-configure bcmath --enable-bcmath \
&& docker-php-ext-configure pcntl --enable-pcntl \
&& docker-php-ext-configure pdo_mysql --with-pdo-mysql \
&& docker-php-ext-configure pdo_pgsql --with-pgsql \
&& docker-php-ext-configure mbstring --enable-mbstring \
&& docker-php-ext-configure soap --enable-soap \
&& docker-php-ext-install \
bcmath \
intl \
mbstring \
mcrypt \
mysqli \
pcntl \
pdo_mysql \
zip \
&& docker-php-ext-configure gd \
--enable-gd-native-ttf \
--with-jpeg-dir=/usr/lib \
--with-freetype-dir=/usr/include/freetype2 && \
docker-php-ext-install gd \
&& docker-php-ext-install opcache \
&& docker-php-ext-enable opcache
当运行 docker-compose up -d 的时候php报错,
error: /usr/src/php/ext/mcrypt does not exist
usage: /usr/local/bin/docker-php-ext-install [-jN] ext-name [ext-name ...]
ie: /usr/local/bin/docker-php-ext-install gd mysqli
/usr/local/bin/docker-php-ext-install pdo pdo_mysql
/usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop
if custom ./configure arguments are necessary, see docker-php-ext-configure
Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring 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 reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zend_test zip
Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.
我觉得是php的Dockerfile 配置有问题,谁有完整的php Dockerfile配置文件啊
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论