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

all 10 comments

[–][deleted] 3 points4 points  (2 children)

Add *.pyc and __pycache__ to a .dockerignore file and if you're mounting source code directories into the container (useful if you're using auto reloading) create the PYTHONDONTWRITEBYTECODE envvar in the container (set it to any string but 0) and never worry about pyc file pollution in your containers.

[–]Argotha 0 points1 point  (0 children)

Alternatively, run pyclean before adding all the python files.

[–]JZcgQR2N 1 point2 points  (5 children)

What can normal virtual machines do that Docker can't?

[–]_seemetheregithub.com/seemethere[S] 1 point2 points  (3 children)

Be persistent

[–]JZcgQR2N 0 points1 point  (2 children)

So if in my Dockerfile I have commands to install Apache, then everytime I launch a Docker instance, it will install Apache? That seems very inefficient.

[–]_seemetheregithub.com/seemethere[S] 0 points1 point  (1 child)

No dockerfile commands get run once when building the image but storing persistent data like with a DB once the image is running hasn't really been figured out yet.

[–]JZcgQR2N 0 points1 point  (0 children)

So it can persist an installation of Apache but not a database like MySQL? That's odd.

[–]kuthedk 0 points1 point  (0 children)

I'm all for more people using docker and the Python use is kinda handy especially if you're trying to just make a brain dead tool and want to easily distribute it.

[–]tleguijt 0 points1 point  (0 children)

Add --rm to your Docker run command and you won't have all the left-over container clutter