I’ve run into an nginx limiting issue that requires me to extend config of my nginx dockerfile, I found a Dockerfile
extension logic listed here but I’m having trouble getting it to work, I’m not sure what I’m supposed to use for the COPY . /app/
for because I don’t need to copy anything into the image to my understanding, I just need that magic script.
Here is the whole Dockerfile for reference
FROM jwilder/nginx-proxy
COPY . /app/
RUN {
# Increased the number of worker_processes from any number to 4
sed -i 's/(worker_processess*)[0-9]*;/14;/' /etc/nginx/nginx.conf;
# Increased the number of worker_connections from any number to 19000
sed -i 's/(worker_connectionss*)[0-9]*;/119000;/' /etc/nginx/nginx.conf;
}
Removing COPY
doesn’t work, the build context just gets huge (over 1GB) so I’m guessing it’s grabbing everything in the repo it’s in.
2
Answers
It's called a
derived dockerfile
I found, and you need to run it in the repo for building that image (not in the repo that you're likely getting that 1GB build context from.So the solution:
Clone the origin repo https://github.com/nginx-proxy/nginx-proxy
Replace the
Dockerfile
with your updated one hereRun your docker build command
I just did this and pushed, publicly available as
kmdanikowski/nginx-proxy
but I recommend you do your own so it can be the most up to date.wader from Github putting his app into the image. You can ignore that.
It is true, you have to remove the
COPY
-line and you will get thenginx-proxy
with the changed settings.Docker will always create a build context. The context contains a copy of ALL files which are in same working directory.
So if you run
docker build .
, then all files (and directories) in the current folder will be added to build context.Never run
docker build
on your root- or home-directory.According to KevinDanikowski’s answer: Yes, his steps working, but these steps are not correct and doesn’t explain the problem.
You have not to clone any git-repo to get the
Dockerfile
working.In this case, it will work, because the linked repo from @KevinDanikowski is not really full.
It is much easier to create just a new folder and put the
Dockerfile
in there.In
BASH
: