先修改dockerfile,增加:
RUN apk add --no-cache openssl-dev \
&& pecl install mongodb \
&& echo "extension=mongodb.so" > /etc/php7/conf.d/mongodb.ini
完整Dockerfile(注意):
# hyperf/hyperf:7.4
#
# @link https://www.hyperf.io
# @document https://hyperf.wiki
# @contact group@hyperf.io
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE
ARG ALPINE_VERSION
FROM hyperf/hyperf:7.4-alpine-v${ALPINE_VERSION}-base
LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT"
ARG SW_VERSION
ARG COMPOSER_VERSION
##
# ---------- env settings ----------
##
ENV SW_VERSION=${SW_VERSION:-"v4.5.7"} \