How to Access the Python Debugger in a Container Running with Docker Compose

A super small guide to access the Python Debugger in a container running in a docker compose setup.

Step 1:
Add the following to the Docker container you want to access the Python debugger in:
stdin_open: true
tty: true

Step 2:
Place a breakpoint somewhere in your code:

breakpoint()

Step 3:
Run the following command to start Docker Compose in detached mode:

docker compose up -d

Step 4:

Attach the terminal to the container you want to debug:

docker attach <container-name>

Tip: find container name by running:

docker ps

Step 5:
Go debug some stuff!