4 ms·
I'm also still not on the docker-wagon and would like to know what I'm missing out on. Most of my stuff is python. Why is docker better than virtualenv with a r
by Fredej 8y ago
I'm also still not on the docker-wagon and would like to know what I'm missing out on. Most of my stuff is python. Why is docker better than virtualenv with a requirements.txt file?
From this description it seems to solve the same issue.
I could imagine something like environment variables, but on the other hand that's something I've learned not to keep in version control, and putting it in docker would be exactly that, no?
- cvakiitho 8y agonot every dependency is written in python.
- anyzen 8y ago> Why is docker better than virtualenv with a requirements.txt file? It's not, it solves a different issue. If you only have Python as dependency, requirements.txt are fine (well, user needs to install correct version of Python, pip and virtualenv / pipenv, but that's doable). But as soon as your app is actually composed of nginx / apache, python, some background process in Rust, bash scripts for cron jobs,... then you have a problem with app delivery, which Docker solves nicely. Just package eveything in a Dockerfile and distribute the image. Bonus point: you can now test it locally, with the same installation. I jumped on Docker wagon very early for this exact reason. I don't care about hype, but it does solve these kinds of problems.
- deleted 8y ago[deleted]
- SteveLTN 8y ago> Why is docker better than virtualenv with a requirements.txt file? You can't put postgres, memcached, imagemagick in requirement.txt, can you?
- Ralfp 8y agoI'm also python dev and I'm embracing docker for delivering my app to users. > Why is docker better than virtualenv with a requirements.txt file One of issues that `docker-compose build` solves better is that venv is superconfusing to your non-python users. I've had people: - skip it and do `python setup.py install` instead - skip it and install requirements globally `pip install -r requirements.txt` because thats how it worked for them last time they used python - version control their `venv` directory - backup and upload their `venv` directory on new server when moving Now they just do `./appctl setup` that asks them for few things, writes `setup.env` file for docker-compose, and then runs `docker-compose build` But this is only beginning. Thanks to `docker-compose` that `build` step also installs: - PostgreSQL database - Redis for caching and message queue - UWSGI - Celery - Nginx proxy
- nickjj 8y agoYou might want to read this blog post as it walks through setting up a dev environment for Python with and without Docker: https://nickjanetakis.com/blog/setting-up-a-python-development-environment-with-and-without-docker https://nickjanetakis.com/blog/setting-up-a-python-developme... The TL;DR is a typical web app is often a lot more than just running Python, and there's a huge amount of value in being able to run the same code across different operating systems without any installation changes.