通常在nginx中编译第三方模块时,应使用以下命令:
./configure --add--module=path/to/your/new/module/directory
然后使用:
make
最后:
make install
但是使用docker我无法进入nginx路径并运行这些命令。如何在我的docker-compose.yml文件中添加“配置”命令?
编辑:我试图创建一个像这样的简单Dockerfile:
FROM nginx
RUN ./configure --add-module=./module/
make && \
make install
并将其包含到我的docker-compose.yml中。
它给了我这个错误:
/bin/sh: 1: ./configure: not found The command '/bin/sh -c ./configure --add-module=./module/' returned a non-zero code: 127
我也尝试使用“配置”而不是“ ./configure”,但是结果相同。我不知道如何设置配置命令。
我不知道我理解正确的问题,但我认为configure
,make
并make install
应作为的一部分docker build
使用的RUN
指令(在Dockerfile
)。docker-compose
只会运行生成的映像(可能与其他docker映像串联)。
示例Dockerfile(未经验证,可能包含错误!):
FROM centos:latest
COPY nginx /root/nginx
WORKDIR /root/nginx
RUN ./configure && make && make install
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句