Docker-compose和pdb [英] Docker-compose and pdb
问题描述
我看到我不是第一个提出这个问题的人,但没有明确的答案:
I see that I'm not the first one to ask the question but there was no clear answer to this:
如何使用pdb与docker-composer Python开发?
How to use pdb with docker-composer in Python development?
当你问叔叔关于 django docker
时,你会获得令人敬畏的Docker-composer示例和教程,我有一个环境工作 - 我可以运行 docker-compise up
,我有一个整洁的开发人员环境,但PDB不工作(这是非常难过)。
When you ask uncle Google about django docker
you get awesome docker-composer examples and tutorials and I have an environment working - I can run docker-compose up
and I have a neat developer environment but the PDB is not working (which is very sad).
我可以通过运行 docker-compose来运行my-awesome-app python app.py 0.0.0.0:8000
但是我可以通过 http://127.0.0.1:8000 从主机访问我的应用程序(我可以与 docker-compise up
),似乎每次使用运行
新的容器如下所示: dir_app_13
和 dir_db_4
我根本不希望。
I can settle with running docker-compose run my-awesome-app python app.py 0.0.0.0:8000
but then I can access my application over http://127.0.0.1:8000 from the host (I can with docker-compose up
) and it seems that each time I use run
new containers are made like: dir_app_13
and dir_db_4
which I don't desire at all.
有帮助的人会帮助我。
PS
我正在使用pdb ++,以及此django示例中的基本docker-compose.yml。我也尝试过,但似乎没有帮助我。而我正在使用docker-comperser 1.3.0rc3 ,因为它具有Dockerfile指向支持
PS
I'm using pdb++ for that example and a basic docker-compose.yml from this django example. Also I experimented but nothing seems to help me. And I'm using docker-composer 1.3.0rc3 as it has Dockerfile pointing support.
推荐答案
尝试使用--service-ports选项运行Web容器: docker-compose run --service-ports web
Try running your web container with the --service-ports option: docker-compose run --service-ports web
这篇关于Docker-compose和pdb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!