MaP
MaP

Reputation: 25

Install nginx dynamic module using docker compose

Usually in nginx to compile a third part module you should use this command:

./configure --add--module=path/to/your/new/module/directory

Then using:

make

And finally:

make install

But using docker I can't go into nginx path and run these commands. How could I add "configure" command to my docker-compose.yml file?

EDIT: I've tried to create a simple Dockerfile like this:

FROM nginx 
RUN ./configure --add-module=./module/ 
     make && \ 
     make install 

And including it into my docker-compose.yml.

And it gave me this error:

/bin/sh: 1: ./configure: not found The command '/bin/sh -c ./configure --add-module=./module/' returned a non-zero code: 127 

I've also tried to use "configure" instead of "./configure", but same result. I don't know how to set configure command.

Upvotes: 2

Views: 8507

Answers (1)

Amit
Amit

Reputation: 1006

I am not sure I understand the question correctly, but I think configure, make and make install should be done as part of docker build using the RUN directive (in your Dockerfile). docker-compose will simply run the resultant image (probably in-tandem with other docker images).

Sample Dockerfile (not verified, may contain errors!):

FROM centos:latest
COPY nginx /root/nginx
WORKDIR /root/nginx
RUN ./configure && make && make install

Upvotes: 3

Related Questions