Docker-compose 和 pdb [英] Docker-compose and pdb

查看:23
本文介绍了Docker-compose 和 pdb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我不是第一个提出这个问题的人,但对此没有明确的答案:

如何在Python开发中使用pdb和docker-composer?

当你向 Google 叔叔询问 django docker 时,你会得到很棒的 docker-composer 示例和教程,我有一个工作环境 - 我可以运行 docker-compose up 并且我有一个整洁的开发人员环境但 PDB 不工作(这很可悲).

我可以通过运行 docker-compose run my-awesome-app python app.py 0.0.0.0:8000 来解决,但随后我可以通过 http://127.0.0.1:8000(我可以使用 docker-compose up)并且似乎每次我使用 run 新容器制作如下: dir_app_13dir_db_4 我根本不想要.

好心人请帮助我.

PS
我在该示例中使用 pdb++ 和来自 this django example 的基本 docker-compose.yml.我也尝试过,但似乎没有任何帮助.我正在使用 docker-composer 1.3.0rc3 因为它具有 Dockerfile 指向支持.

解决方案

尝试使用 --service-ports 选项运行您的 Web 容器:docker-compose run --service-ports web

I see that I'm not the first one to ask the question but there was no clear answer to this:

How to use pdb with docker-composer in Python development?

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).

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.

People of good will please aid me.

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.

解决方案

Try running your web container with the --service-ports option: docker-compose run --service-ports web

这篇关于Docker-compose 和 pdb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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