4 ms·
Once 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.
by 0xCMP 9y ago
Once 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).