The Linux Container Tutorial guides users through packaging an application for Linux environments using container technology. This tutorial is designed to work across several Linux-based platforms, including the Tachyon (QCx6490-based), Raspberry Pi, and Nvidia Orin/Jetson boards, demonstrating a portable and reproducible deployment method.
- Introduction
- Prerequisites
- Getting Started
- Running the Application
- API Usage
- Project Structure
- Contributing
Welcome to the Linux Container Tutorial! This tutorial provides a basic example of how to package a Python application into a container for deployment on Linux systems. It’s designed for compatibility with several boards, including Particle's Tachyon, Raspberry Pi, and Nvidia Jetson, making it easy to achieve portable, reproducible deployments.
For this tutorial, you’ll need:
- Podman: A container engine compatible with Docker. Install Podman
- Podman Compose: A tool to manage multi-container applications using
podman-compose.yaml
. Install Podman Compose
Clone or download this project to your local machine:
git clone https://github.com/particle-iot/linux-container-tutorial
cd linux-container-tutorial
-
Build the Container Image:
podman-compose -f podman-compose.yaml build
-
Run the Container:
podman-compose -f podman-compose.yaml up
The app will start and be accessible on http://localhost:8000.
To stop the container, run:
podman-compose -f podman-compose.yaml down
The application exposes a simple /add
endpoint, where you can provide two numbers as query parameters (a
and b
) to receive their sum.
To add 5 and 3, make a GET request to:
http://localhost:8000/add?a=5&b=3
{
"result": 8.0
}
If either parameter is missing or invalid, the API will return an error message.
We welcome contributions to improve this project! If you'd like to suggest changes, please fork the repository and open a pull request.
- Fork the repository.
- Make your changes in a new branch.
- Open a pull request with a detailed description of your changes.