Docker开发环境中丰富的编辑器 [英] Rich editors in a Docker development environment

查看:138
本文介绍了Docker开发环境中丰富的编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我的团队和我已经买了Docker - 这对于部署和测试来说非常棒。我的真正问题是如何建立一个伟大的开发人员体验,特别是在编写Python应用程序时,但这个问题可以推广到nodejs,Java等。



问题:在编写一个Python应用程序时,我真的很喜欢拥有体面的linting / autocomplete功能,还有一些很好的编辑器(Atom,VSCode,PyCharm)可以提供这些功能,但是大多数人真的希望在本地磁盘上安装一个Python。 Docker的真正优势是,所有的核心语言和任何项目库都可以在容器中,因此在主机上复制所有这些只是为了开发,这是一个痛苦。


$ b $我知道PyCharm专业版支持Docker和Docker-compose,但是我发现它非常缓慢,许多测试运行功能被破坏。除此之外,我真的希望我能够承担版本控制的一些东西,以便团队可以共享开发人员设置,而且人们不需要为自己的系统重复所有步骤。



我有一些想法是:


  1. 在旁边的Docker容器中安装一个编辑器(如Atom)使用X11转发

  2. 使用基于浏览器的编辑器,如 https://c9.io/ 在容器中 - 这似乎最有希望的

  3. 在一个可以处理自动完成/ linting等的dev容器中安装一些代理,并从本地运行的编辑器连接到它认为这将是最好的解决方案,但我也认为现在实际上不存在。

有没有人有运气设置除了加载卷和编辑文本之外,还有一个更有效的开发环境?

解决方案

您应该使用像我这样的IDE ntelliJ(Pycharm)使用SSH访问Docker-Container配置一个远程Python SDK (在开发人员图像上使用开发人员共享的ssh密钥与预先安装的openssh服务器和预配置的授权文件)。
您可以在项目文件中共享此SDK信息,以便所有开发人员都可以使用它



1)这将确保您的IDE知道所有可用的python库/在运行时安装在docker-container中。并且还将使您能够在同一时间远程正确调试



2)这也可以确保您有一个正确的IDE在您手上,所有的功能,你可以想的。几乎没有任何基于浏览器的IDE将赶上Pycharm



当然,如同注释中已经提到的,您需要将代码分享到容器中。在linux上,您明确地将主机容量挂载到您的本地src文件夹到容器。



在OSX上,您将遇到性能问题,可能会使用< a href =http://docker-sync.io =nofollow noreferrer> http://docker-sync.io (我有偏见 - 还有很多其他类似的工具)


So my team and I have bought into Docker - it is fantastic for deployment and testing. My real question is how to set up a great developer experience, specifically around writing Python apps, but this question could be generalized to nodejs, Java, etc.

The problem: When writing a Python app, I really like having decent linting/autocomplete functionality, there are some really good editors out there (Atom, VSCode, PyCharm) that provide these, but most really want a Python install on the local disk. The real advantage of Docker is that all of the core language and any project libraries can all be in the container, so reproducing all of that on the host machine just for developing is a pain.

I know that PyCharm pro does support Docker and docker-compose, but I found it quite sluggish and a lot of the test running capabilities were busted. On top of that, I really would like something that I can commit to version control so that the team can share dev setup and people don't have to repeat all of the steps for their own system.

A few Ideas that I had were:

  1. Install an editor (like Atom) in a sidecar Docker container and use X11 forwarding
  2. Use a browser based editor such as https://c9.io/ in a container - this seems most promising
  3. Install some agent in a dev container that could handle autocomplete/linting, etc. and connect to it from a locally running editor - I think this would be the best solution, but I also think that right now it actually doesn't exist.

Has anyone had luck setting up a more productive development environment besides just mounting volumes and editing text?

解决方案

You should use a proper IDE like IntelliJ (Pycharm) configure a remote Python SDK using SSH-Access to your Docker-Container (use a developer-shared ssh-key on the developer-image with a preinstalled openssh server and preconfigured authorized files). You can share this SDK information in your project files so all devs will have it

1) This will ensure, your IDE knows about all the python libs available/installed in your docker-container during runtime. And will also enable you to properly debug remotely at the same time

2) This also ensures, you have a proper IDE at your hand, with all the features you can think of. And hardly any of the Browser-Based IDEs will catch up with Pycharm

Of course, as already mentioned in the comments, you need to share your code into the container. On linux, you plainly use host-volume-mounts form your local src folder to the container.

On OSX, you will run into performance issues and might use something like http://docker-sync.io ( i am biased - there are also a lot of other similar tools )

这篇关于Docker开发环境中丰富的编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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