7

I am trying to get pdb working with docker

We have just started using docker in development. I run python scripts inside docker

I can attach to a docker container:

 docker exec  -ti 6e2355917804  /bin/bash 

I can tail the output

 docker attach 6e2355917804

I've read this but I'm not using fig.

I can see the code hit the breakpoint but I can't interact with PDB.

Docker version 1.7.1,

andy boot
  • 11,355
  • 3
  • 53
  • 66

2 Answers2

5

In case you are using docker compose, you need to do the following.

Step 1. Add the following in your yml file

stdin_open: true
tty: true

This will enable interactive mode and will attach stdin. This is equivalent for -it mode.

Step 2.

docker attach <generated_instance_id>

You'll now get the pdb shell

Arun Kumar Nagarajan
  • 2,347
  • 3
  • 17
  • 28
3

I wasn't using the -i flag when launching my original docker container. Make sure to use

docker run -it <job>
andy boot
  • 11,355
  • 3
  • 53
  • 66