Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

celery pdb running inside docker container with changing listening port

Looking for advice on how I can run celery pdb inside my docker container while port forwarding so i can access from the outside world.

I am following the guide at http://celery.readthedocs.org/en/latest/tutorials/debugging.html

The issue I am facing is that even when I tell the container.

-e CELERY_RDB_HOST='0.0.0.0' -e CELERY_RDB_PORT='6900' -p 6900:6900.

And get to the breakpoint in the app, the port that actually gets open is not what I asked for so my port forward no longer is valid.... Eg. the port 6902 gets opened instead, and no matter what I ask the port to be, it changes again to not what I asked for.

I know it chooses from a list of 100 ports that it deems 'available' but not sure how to get around this problem. Any advise would be welcome.

Thanks!

like image 760
user1601716 Avatar asked Aug 30 '14 15:08

user1601716


1 Answers

You can run your container by specifying a range of ports (see http://docs.docker.com/reference/run/#expose-incoming-ports):

docker run -d -e CELERY_RDB_HOST='0.0.0.0' -p 6900-7000:6900-7000 celery

After that, when you hit your breakpoint, you just need to telnet into it:

telnet localhost 6902
like image 142
Rémy Greinhofer Avatar answered Oct 13 '22 04:10

Rémy Greinhofer