我有一个使用 docker-compose.yml
运行的容器文件。
version: '3'
services:
db:
<...>
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
我需要 enable LDAP on PHP但我真的不知道如何完成教程中解释的步骤。
You will need to use the --with-ldap[=DIR] configuration option when compiling PHP to enable LDAP support.
我应该如何在正在运行的容器上执行此操作?是否应该在运行
docker-compose up
之前完成?如果是这样,我应该使用哪种环境配置?
最佳答案
您只需要使用不同的图像,因为使用原始图像不容易配置。
看看dalareo/docker-wordpress-ldap-support在 GitHub 上。您可以通过将 Dockerfile 下载到您的项目将存储的目录来使用此 Dockerfile,并对您的 docker-compose.yml 进行小幅更改,如下所示:
version: '3'
services:
db:
<...>
wordpress:
depends_on:
- db
# remove: image: wordpress:latest and put this instead:
build: .
# and place the rest of the definitions you normally have there
从 repo 复制的 Dockerfile:
FROM wordpress
RUN set -x \
&& apt-get update \
&& apt-get install -y libldap2-dev \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install ldap \
&& apt-get purge -y --auto-remove libldap2-dev
编辑
我从这个 Dockerfile 中找到了一个公共(public)注册表镜像构建
现在您实际上不必对原始 docker-compose.yml 文件进行任何更改,除了更改您的 wordpress 预期运行的图像。来自
wordpress:latest
至dalareo/wordpress-ldap
关于php - 如何在 dockerized Wordpress 上启用 LDAP?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50251737/