Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
293 views
in Technique[技术] by (71.8m points)

python - 使用docker时virtualenv是否达到目的(在生产中)?(Does virtualenv serve a purpose (in production) when using docker?)

For development we use virtualenv to have an isolated development when it comes to dependencies.

(对于开发,当涉及到依赖项时,我们使用virtualenv进行隔离开发。)

From this question it seems deploying Python applications in a is recommended.

(从这个问题来看,似乎建议在部署Python应用程序。)

Now we're starting to use for deployment.

(现在,我们开始使用进行部署。)

This provides a more isolated environment so I'm questioning the use of virtualenv inside a docker container.

(这提供了一个更隔离的环境,因此我质疑docker容器内virtualenv的使用。)

In the case of a single application I do not think virtualenv has a purpose as docker already provides isolation.

(对于单个应用程序,我不认为virtualenv有目的,因为docker已经提供了隔离。)

In the case where multiple applications are deployed on a single docker container, I do think virtualenv has a purpose as the applications can have conflicting dependencies.

(在将多个应用程序部署在单个docker容器上的情况下,我确实认为virtualenv具有用途,因为这些应用程序可能具有冲突的依赖关系。)

Should virtualenv be used when a single application is deployed in a docker container?

(在Docker容器中部署单个应用程序时应使用virtualenv吗?)

Should docker contain multiple applications or only one application per container?

(docker应该包含多个应用程序还是每个容器仅包含一个应用程序?)

If so, should virtualenv be used when deploying a container with multiple applications?

(如果是这样,那么在部署具有多个应用程序的容器时是否应该使用virtualenv?)

  ask by siebz0r translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Virtualenv was created long before docker.

(Virtualenv是在docker之前创建的。)

Today, I lean towards docker instead of virtualenv for these reasons:

(今天,由于以下原因,我倾向于docker而不是virtualenv:)

  • Virtualenv still means people consuming your product need to download eggs.

    (Virtualenv仍然意味着消费您产品的人们需要下载鸡蛋。)

    With docker, they get something which is "known to work".

    (有了docker,他们得到了“已知有效”的东西。)

    No strings attached.

    (没有任何附加条件。)

  • Docker can do much more than virtualenv (like create a clean environment when you have products that need different Python versions).

    (Docker的功能远不止virtualenv(例如,当您拥有需要不同Python版本的产品时,创建一个干净的环境)。)

The main drawback for Docker was the poor Windows support.

(Docker的主要缺点是对Windows的支持不佳。)

That changed with the version for Windows 10.

(对于Windows 10版本,情况发生了变化。)

As for "how many apps per container", the usual policy is 1.

(至于“每个容器有多少个应用程序”,通常的策略是1。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...