Docker和Python virtualenv有什么区别? [英] What's the difference between Docker and Python virtualenv?

查看:161
本文介绍了Docker和Python virtualenv有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我对Docker的了解,它是用于虚拟环境的工具。用他们的术语来说,它叫做容器化。这差不多就是Python的virtualenv所做的。但是,您可以在Docker中使用virtualenv 。那么,它是虚拟环境内部的虚拟环境吗?我对这甚至如何工作感到困惑,所以有人可以澄清一下吗?

解决方案

virtualenv仅封装Python依赖项。 Docker容器封装了一个整个操作系统



使用Python virtualenv,您可以轻松地在Python版本和依赖关系之间进行切换,但是却遇到了麻烦



使用Docker映像,您可以换出整个操作系统-在Ubuntu,Debian,Alpine甚至Windows Server Core上安装并运行Python。 / p>

这里有Docker 图像您可以想到的所有操作系统和Python版本的组合,都可以在安装了Docker的任何系统上进行下拉和使用。


From what I understand about Docker, it's a tool used for virtual environments. In their lingo, its called "containerization". This is more or less what Python's virtualenv does. However, you can use virtualenv in Docker. So, is it a virtual environment inside a virtual environment? I'm confused as to how this would even work, so could someone please clarify?

解决方案

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.

这篇关于Docker和Python virtualenv有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆