What’s the difference between Docker and Python virtualenv?

A virtualenv only encapsulates Python dependencies. A Docker container encapsulates an entire OS.

With a Python virtualenv, you can easily switch between Python versions and dependencies, but you’re stuck with your host OS.

With a Docker image, you can swap out the entire OS – install and run Python on Ubuntu, Debian, Alpine, even Windows Server Core.

There are Docker images out there with every combination of OS and Python versions you can think of, ready to pull down and use on any system with Docker installed.

Leave a Comment