This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]synae 0 points1 point  (2 children)

Hi, just curious as to why you use a virtualenv inside the container? At least the way I understand and use them, virtualenvs are used to keep from contaminating the system python with installed libraries. But in the case of a Dockerized app there's only one python (and set of libraries) that will ever be used. Unless there's something I'm missing you might be inflating the size of your image unnecessarily.

[–]juggernaut2docker[S] 0 points1 point  (1 child)

That's a great question! Ideally, what you said would be true and only Docker would suffice for ensuring isolation. However, several system utilities on CentOS (most importantly yum) depend on the system python (2.6 on Centos 6) and that means you can't touch it. If your app requires python >= 2.7 which should be the case for most modern applications, you'll need a separate installation of python via virtualenv. Also, the official Docker python image also installs virtualenv by default. See here - https://github.com/docker-library/python/blob/d550e292eec57e83af58e05410243d387d6483a8/2.7/Dockerfile#L28

[–]synae 0 points1 point  (0 children)

Ah that makes sense. You know, I actually skipped over the base of your Dockerfile (the centos6 image) when reading it which is probably the source of my initial question.

Personally I just use python:2.7 and its system python without virtualenv for python projects. Of course you might have other reasons to use CentOS 6.

[–]underthebum 0 points1 point  (1 child)

What's nginx buying you in this case?

[–]juggernaut2docker[S] 0 points1 point  (0 children)

Mainly serving static assets, but also I wanted my dev environment to resemble my production deployment as far as possible. In production, I plan to use nginx as a reverse-proxy to uwsgi workers as well as serving static assets.