Hi Khaled, thank you for your post. It was a great help to start understanding how to debug my Odoo application.
I'm new to Docker & Docker compose and I'm struggling to get Debugpy to work with Odoo and VS code. I'm using a docker-compose file that runs Odoo fronted by Nginx.
Debugpy is already installed in the container but I'm can't see how I can run my container with both Odoo & Nginx "wrapped" by Debugpy.
In your post, I cannot see how the command :
docker-compose run --rm -p 8888:8888 -p 8869:8069 {DOCKER IMAGE[:TAG|@DIGEST]} .....
applies to my case. My docker-compose is running both Odoo & Nginx and I would like to be able to debug with this configuration in VS code.
Hello Farid
please note that when using debugpy to debug python apps (Odoo server in our case). you're overriding the entrypoint.sh of the container. by other words you are starting the debugpy server inside of the container instead of Odoo server.
take a look at the following command:
/usr/bin/python3 -m debugpy: here you ask python to start module debugpy --listen 0.0.0.0:8888: here you aske debugpy server to listen 0.0.0.0:8888 /usr/bin/odoo: here you ask debugpy to start a python process (in our case odoo server) --db_user=odoo --db_host=db --db_password=odoo: here, are the rest of odoo cli
so if you are debugging a different python file named tic_tac_toe.py, the command would be something like
python -m debugpy tic_tac_toe.py
the first portion of the docker-compose command:
docker-compose run --rm-p 8888:8888 -p 8869:8069 {DOCKER IMAGE[:TAG|@DIGEST]}
it is asking docker-compose to map ports of the host to ports of the container & running the image. please note that you have to replace {DOCKER IMAGE[:TAG|@DIGEST]} with image information. you can get such information from command docker images -a
~ → docker images -a
REPOSITORY TAG IMAGE ID CREATED SIZE
odoo 14 27c34e85682c 2 weeks ago 1.24GB
odoo 14.0 27c34e85682c 2 weeks ago 1.24GB
postgres 13 a6cd86e1dfce 3 weeks ago 314MB
so in my case it could be
docker-compose run --rm odoo:13
# or
docker-compose run --rm a6cd86e1dfce
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Khaled, thank you for your post. It was a great help to start understanding how to debug my Odoo application.
I'm new to Docker & Docker compose and I'm struggling to get Debugpy to work with Odoo and VS code. I'm using a docker-compose file that runs Odoo fronted by Nginx.
Debugpy is already installed in the container but I'm can't see how I can run my container with both Odoo & Nginx "wrapped" by Debugpy.
In your post, I cannot see how the command :
docker-compose run --rm -p 8888:8888 -p 8869:8069 {DOCKER IMAGE[:TAG|@DIGEST]} .....
applies to my case. My docker-compose is running both Odoo & Nginx and I would like to be able to debug with this configuration in VS code.
Would you have any advice?
Thanks!
Farid
Hello Farid
please note that when using debugpy to debug python apps (Odoo server in our case). you're overriding the entrypoint.sh of the container. by other words you are starting the debugpy server inside of the container instead of Odoo server.
take a look at the following command:
/usr/bin/python3 -m debugpy
: here you ask python to start module debugpy--listen 0.0.0.0:8888
: here you aske debugpy server to listen 0.0.0.0:8888/usr/bin/odoo
: here you ask debugpy to start a python process (in our case odoo server)--db_user=odoo --db_host=db --db_password=odoo
: here, are the rest of odoo cliso if you are debugging a different python file named tic_tac_toe.py, the command would be something like
the first portion of the docker-compose command:
it is asking docker-compose to map ports of the host to ports of the container & running the image. please note that you have to replace
{DOCKER IMAGE[:TAG|@DIGEST]}
with image information. you can get such information from commanddocker images -a
so in my case it could be