使用docker撰写安装nginxdynamic模块
通常在nginx中编译第三部分模块,你应该使用这个命令:
./configure --add--module=path/to/your/new/module/directory
然后使用:
make
最后:
make install
但是使用docker我不能进入nginxpath并运行这些命令。 我怎么能添加“configuration”命令到我的docker-compose.yml文件?
编辑:我试图创build一个简单的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
我也尝试使用“configuration”而不是“./configure”,但结果相同。 我不知道如何设置configuration命令。
我不知道我是否正确理解这个问题,但我认为使用RUN
指令(在您的Dockerfile
) configure
, make
和make install
应该作为Dockerfile
docker build
一部分来完成。 docker-compose
将简单地运行最终的图像(可能与其他docker图像串联)。
示例Dockerfile(未validation,可能包含错误!):
FROM centos:latest COPY nginx /root/nginx WORKDIR /root/nginx RUN ./configure && make && make install