英文:
Do I don't need to install anything without docker?
问题
你好,我是你的中文翻译。以下是翻译好的部分:
"你好,我是新手使用Linux(Ubuntu)和Docker。我想要使用Docker为每个项目设置开发环境。例如,Project1使用VSCode + Python(版本1)+一些pip模块,而Project2使用PyCharm + Python(版本2)+一些pip模块。
那么,主机操作系统是否不需要IDE(如VSCode、PyCharm)和编程语言(例如Python 3.xx.x、3.yy.y)?因为Docker镜像包含了项目的环境,甚至包括IDE和语言。"
英文:
Hi I'm new to linux(ubuntu) and docker. I would like to use docker to set development environment for each project. e.g. Project1 use vscode + python(version1) + some pip modules and Project2 use Pycharm + python(version2) + some pip modules.
Then, does host OS need no IDE(vscode, pycharm), programming language(e.g. python(3.xx.x, 3.yy.y)? Because a docker image has project's environment even IDE and language.
答案1
得分: 1
以下是翻译的内容:
第一个重要的技术答案是:Docker 镜像很少包含IDE,而且在容器中运行GUI应用程序有点棘手。因此,您必须在主机上安装IDE。
第二个重要的技术说明是容器具有隔离的文件系统。Docker的一个核心特性是容器无法访问主机文件系统,主机也无法查看容器中的文件。这也意味着,如果您将整个开发环境隐藏在容器中,您不能只是在其中运行Python解释器;您需要使用诸如docker exec
之类的调试工具来使用它,并且需要特殊的IDE支持来在这个环境中工作。
根据您描述的情况,我可能不会安装Docker。两个IDE都需要直接安装在主机上。您可以使用诸如pyenv之类的版本管理器来使两个Python版本可用,然后使用Python虚拟环境来隔离每个应用程序的依赖项(参见Python Packaging User Guide)。
如果您真的不想在主机系统上安装任何东西,还有一些工具,比如Vagrant,可以将完整的开发环境安装到虚拟机中;它还可以针对Docker环境进行部署。但是您的Ubuntu系统还包括Debian的APT包装系统和相当广泛的软件包目录,因此在主机上安装东西并不那么复杂,而且清理也相当容易。
英文:
The first important technical answer is this: Docker images rarely if ever contain IDEs, and it's kind of tricky to run GUI applications in containers. So you have to install the IDE on the host.
The second important technical statement is that a container has an isolated filesystem. A core feature of Docker is that containers can't access the host filesystem, and the host can't see files in the container. This also means that, if you've hidden your entire development environment inside a container, you can't just run the Python interpreter in it; you need to use debugging tools like docker exec
to use it, and you need special IDE support to work in this environment.
Looking at what you describe, I might not install Docker at all. Both IDEs intrinsically need to be installed directly on the host. You can use a version manager such as pyenv to have both Python versions available, and then a Python virtual environment to isolate the per-application dependencies (see the Python Packaging User Guide).
If you really want to install nothing at all on the host system, there are also tools like Vagrant that can install a complete developer environment into a VM; it can also target a Docker environment. But your Ubuntu system also includes Debian's APT packaging system and a pretty broad catalog of packages, so installing things on the host isn't that complicated and it's pretty easy to clean up.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论