3 ms·
It doesn't. Imagine you just want to run some utility written in Python (let's use youtube-dl since it is been on front page lately), why do I need to install D
by yeukhon 9y ago
It doesn't. Imagine you just want to run some utility written in Python (let's use youtube-dl since it is been on front page lately), why do I need to install Docker to run a simple command? For isolation? No thanks. Virtualenv was created to isolate overwrittkng and installing dependencies.
Also, want to emulate multi-sites on single machine deployment? You need virtualenv.
- icebraining 9y agoDocker does solve those problems, even if you and I prefer to use other solutions. And by the way, you don't actually need virtualenv :) we run multiple webapps on a machine by just installing dependencies in a directory (pip -t) in the git repo, and then adding the appropriate PYTHONPATH in the service's startup config. As long as you don't need multiple versions of the Python interpreter, this works fine.
- eeZah7Ux 9y ago> Docker does solve those problems ...with a very computationally expensive solution, and without improving other aspects like security. A systemd unit on a "chroot" can do the same and provide isolation.
- floatboth 9y agoIs it really computationally expensive? Containers/jails/zones are essentially chroots "on steroids", isolating things other than the filesystem (networking, hostname, process IDs, users, etc.)
- 0xCMP 9y agoOnce built a docker container is not expensive, but the idea with Docker is to create immutable, layered containers and rebuilding every time there is a change. Unlike with nodejs, it's harder to volume mount python packages installed in the docker container and so no one does it. Change in requirements means rebuilding the container which is a very computationally and IO expensive process. So if you can get away with it virtualenv is better, but putting everything in a container so you can simply ship a container is also useful. It's a compromise.
- icebraining 9y agoRebuilding the container shouldn't be expensive, that's what layers are for.
- 0xCMP 9y agoA layer with your pip requirements being added and then installed is the most expensive part of building a python container so if you change your requirements you invalidate the cache for that layer (and possibly the other layers above).