Docker-nginx: Is it possible to copy the Nginx Dockerfile?

Created on 1 Feb 2017  路  16Comments  路  Source: nginxinc/docker-nginx

Hey! We're building a complex Dockerfile that bases its installation of Nginx off of the stable Jessie build.

Recently, when the version was bumped up here, our docker builds began to break. I'm not too familiar with Jessie and apt-get, so I was wondering if someone knowledgeable here could help me understand if there's something I should modify in the Dockerfile to make it not be tied to the build here.

Just to be clear, literally copied the Dockerfile except we left out the CMD and the EXPOSE etc. The error we were getting had to do with installing nginx, with all the modules (nginx-module-xlst, nginx-module-geoip, etc.) suddenly having a hard dependency on the latest version of nginx (1.10.3 vs 1.10.2).

Thanks so much!

bug

Most helpful comment

Changing everything to gnupg2 and adjusting stretch to jessie fixes everything! Thanks!

All 16 comments

Probably need to specify the version on all those other packages just like nginx on line 12. Though I am not sure how long the nginx apt repo will keep old versions available.

Is there a reason that you are not just doing FROM nginx:1.10.2 and then adding your customization? If you need a more concrete build version you could follow the hashes over in repo-info.

I see I'll try that suggestion out. That would be problematic if they don't keep those versions available for a reasonable amount of time...

Yea, the reason for that is I'm already doing FROM python:3.5 instead. I'm installing several things in this image, and I arbitrarily chose the python base image since our application is mainly Python.

If you're doing FROM python, why don't you have a seperate container for nginx?

There are two distinct modes of thought with docker. There is one extreme of having each docker container running a very small service (like Nginx) and composing it with something like docker compose.

The other extreme is treating it like a VM and tossing everything together.

Generally the latter is discouraged. However, an middling view is to have each docker container run a distinct service, and be ok with the fact that multiple "services" run in one container. This is the approach we've been taking with a lot of our apps since one docker container is incredibly lightweight and offers distinct advantages over having to compose a bunch together.

Long story short, this is why we don't have a separate container for nginx, because our one container that essentially delivers our application (both frontend and backend) is super light and very easy to work with. Except when this type of problem occurs. Which it just did today!

Will look into a way to fix it more consistently.

I guess adding an explicit version to the modules wont hurt in the Dockerfile we ship. Opinions?

I am doing the same thing as @impguard where I am starting from a different base image (python 2.7) and then I have copied the content of this image into my dockerfile. The latest version solves my issues with version incompatibilities but now I can't build because of the following error:
Unable to locate package gnupg1
Is this caused by the move to stretch-slim?

@camerondgray yes.

Do you have any advice as to how I can fix this on my end or is my use case just not going to work anymore? Thanks

Edit the RUN command so gnupg1 is not installed/removed, if your image already has gnupg.

I ended up changing from gnupg1 to gnupg2 for my python3.5 base image (jessie base).

However, I then run into this issue:

nginx : Depends: libssl1.1 (>= 1.1.0) but it is not installable

Unfortunately libssl1.1 seems to not be standard for Jessie yet. How did you get around this @camerondgray ?

@impguard Sadly I haven't gotten around that. That is precisely where I am stuck as of right now.

s/stretch/jessie/ in your deb line you're copy-pasting from nginx Dockerfile

Changing everything to gnupg2 and adjusting stretch to jessie fixes everything! Thanks!

@impguard can you paste a copy of your deb line? I am still struggling with this. Thanks!

Original issue is fixed in nginx:1.12.0 / nginx:1.13.0.

Not sure this is fixed. Looking at 1.12 stable dockerfile:

https://github.com/nginxinc/docker-nginx/blob/7e278fff2f12f852ef1be2aed17e9a2f822365ac/stable/stretch/Dockerfile

using python 3.5, it's necessary to s/gnupg1/gnupg2 and s/stretch/jessie to get the install working properly. Would be helpful to have this somewhere in a readme until this is stable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ralphsmith80 picture ralphsmith80  路  5Comments

eigood picture eigood  路  5Comments

hasancansaral picture hasancansaral  路  6Comments

luckymark picture luckymark  路  4Comments

colinmollenhour picture colinmollenhour  路  6Comments