Tutorial: Develop with Containers#

Develop and debug SKAO applications using containers and VS Code.

Set up a containerised development environment, build container images, and debug Python applications inside containers.


Why develop with containers?#

Containers provide these benefits:

  • Develop and test without installing Tango locally

  • Use identical environments for development, testing, and deployment—eliminating “works on my machine” problems

  • Manage dependencies consistently across your team

  • Clean up easily—destroy and recreate containers without side effects

Prerequisites#

Ensure you have:

Note

Most instructions assume Docker, but Podman works with minor differences. See the Podman caveats in VS Code documentation.

Step 1: Clone and open the project#

Clone the ska-tango-examples repository:

git clone --recurse-submodules https://gitlab.com/ska-telescope/ska-tango-examples.git

Open VS Code from inside the project folder:

cd ska-tango-examples && code .

Step 2: Build the application image#

Open a terminal in VS Code (Terminal → New Terminal) and build the Docker image:

make oci-build

Step 3: Debug a Python file#

Inside the container, use the vscode-debug.sh utility to debug a specific file:

./vscode-debug.sh powersupply/powersupply.py

The terminal displays:

tango@b2dbf52b73c7:/app$ ./vscode-debug.sh powersupply/powersupply.py
[+] Waiting for debugger attachment.

Step 4: Attach the VS Code debugger#

  1. Set breakpoints in your code by clicking in the gutter next to line numbers

  2. Press F5 or click the debug button under the Debug tab

  3. The debugger attaches and stops at your breakpoints

For more on VS Code debugging, see the VS Code Debugging documentation.

Next steps#


See Also#