人们为什么在docker容器中创建virtualenv? [英] Why people create virtualenv in a docker container?

查看:111
本文介绍了人们为什么在docker容器中创建virtualenv?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以在几秒钟内用Dockerfile构建一个容器,然后为什么人们需要在Docker容器内安装虚拟环境?

You can build a container with Dockerfile in a few seconds, then why people needs to install a virtual enviroment inside the docker container?

这就像一个虚拟机 在虚拟机中?

It's like a "virtual machine" in a virtual machine ?

推荐答案

我正在Docker中使用virtualenvs,我认为有以下几个原因:

I am working with virtualenvs in Docker and I think there are several reasons:


  1. 您可能希望将应用程序与系统的python软件包隔离

  2. 您可能要运行自定义版本的python但仍然保持系统软件包不变

  3. 您可能需要对为特定应用程序安装的软件包进行精细控制

  4. 您可能需要运行多个应用程序

  1. you may want to isolate your app from system's python packages
  2. you may want to run a custom version of python but still keep the system's packages untouched
  3. you may need fine grain control on the packages installed for a specific app
  4. you may need to run multiple apps with different requirements

我认为,这些都是添加一些 pip install virtualenv 安装结束! :)

I think these are all reasonably good reasons to add a little pip install virtualenv at the end of the installation! :)

这篇关于人们为什么在docker容器中创建virtualenv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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