When trying to develop and debug in container environment, in lieu of local machine

Purpose

  1. Save space: Avoiding install/keep the same dependency/lib twice, i.e. on local machine and in container
  2. Keep consistency: Avoiding inconsistency due to different dependency/lib on local machine v in container

Step-by-step guide

Note: This guide is based on VS Code. I've also tried IntelliJ IDEA (including PyCharm), but unfortunately it doesn't work on my laptop. If interested, see the link below under "Read more"

Install extension and launch docker

On VS Code, make sure you've installed the extension Remote - Containers

Launch docker (you don't need to start the project container)

Read more

Guide from VS code: https://code.visualstudio.com/docs/remote/create-dev-container

Guide from JetBrains (IntelliJ IDEA, PyCharm): https://www.jetbrains.com/help/idea/configuring-remote-python-sdks.html#Docker

Related issues