Docker is a software that lets you to setup an app like a running part of your device. It's like a virtual machine but lighter. A docker container get the resorces by the local system so it's not a operative system by himself.

With a Docker container you can determinate the versions of the dependencies, so you will not have a version issue in the future.

Also, is great to make a deploy, so it is working in local it will do it in the server

Virtualenv provides dependency isolation for a specific programming language - it lets you use different versions of Python and keep the pip packages you want located within the project space you setup.

Docker is a similar concept in that it keeps things isolated, but it steps down a tier lower in the stack. Docker lets you build containers that are effectively smaller operating systems in a can that can leverage the host OS's resources through the Docker daemon.

You can create a Dockerfile that creates a container which installs Python, installs the pip dependencies using a Pipfile inside the container, and then run the app using that container all without causing an impact to the local filesystem on the machine that is executing the container.

A Docker container's only contract to the outside world is exposing a port to allow traffic to communicate into the service inside of the container.

It can install images from docker repositories like docker hub. Which is a bit like installing npm packages.

The difference is that npm packages are plain directories and files that live beside your app. The images also isolate your app from the rest of the OS, while providing general software (applications & libraries, not only JS packages) for your application to use.

Also one image could deliver basics of a Ubuntu system, then a Nginx image could extend that Ubuntu image with added libraries and Nginx preinstalled and then you would extend the Nginx image with the your html&css that the preinstalled Nginx should serve.