Python Wolfi-based Docker Image: nnthanh101/python
ΒΆ
OverviewΒΆ
The nnthanh101/python:cloudops
image is a secure, lightweight, and production-grade Python environment built on Chainguard's Wolfi Base. This image has been optimized to support multi-cloud environments (AWS, Azure) and cross-platform workflows for analytics, automation, and data science projects.
With a focus on modern CloudOps and DevOps practices, this image incorporates security, maintainability, and scalability into its design. It integrates essential extensions like JupyterLab, Vizro, and MkDocs for analytics and documentation workflows.
Key FeaturesΒΆ
- Lightweight and Secure:
- Built on
cgr.dev/chainguard/wolfi-base:cloudops
, prioritizing security with minimal attack surface. - Non-root
os
user pre-configured to ensure security. - Cross-Platform Support: Supports multiple architectures, including
linux/amd64
andlinux/arm64
.
-
Cloud-Native Utilities: Pre-installed tools like
starship
,task
,git-lfs
, and support for pre-configuredPython 3.12
virtual environment support for compatibility with modern workflows. Integrated also withawscli
,azure-cli
, andansible
for provisioning and automation. -
Pre-Bundled Python Extensions: Categorized for analytics, documentation, and cloud operations with AWS CLI, and Azure CLI.
UsageΒΆ
Run a Python Shell and TasklistΒΆ
Syntax:
docker run -it -p 8888:8888 -v LOCAL_FOLDER:REMOTE_FOLDER registry/image
docker run -it --rm nnthanh101/python:cloudops python
## Run a Tasklist
docker run -it --rm nnthanh101/python:cloudops task
Run with Data MountingΒΆ
- ## TODO: -e DEBUG=1 &&
export HOST_AWS="$HOME/.aws"
docker run -it -p 8888:8888 \
-v "$(pwd):/workspace:rw" \
-v "${HOST_AWS}:/workspace/.aws:ro" \
--user $(id -u):$(id -g) \
nnthanh101/python:cloudops
Use for JupyterLabΒΆ
USERNAME=os
docker run -it -p 8888:8888 \
-v $HOME/notebooks:/home/$USERNAME/notebooks \
nnthanh101/python:cloudops jupyter lab --ip=0.0.0.0 --no-browser
Extend the ImageΒΆ
To add custom Python packages:
FROM nnthanh101/python:cloudops
COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
DevContainer UsageΒΆ
- Project/Folder Structure:
Ensure the host project directory is structured as follows:
βββ .devcontainer ## VS Code DevContainer configuration
β βββ devcontainer.json
βββ projects ## Your code and Python projects
βββ credentials ## AWS credentials, config files, etc.
βββ data ## Raw and processed data files
- Run Command via VS Code:
- Open the project folder in VS Code.
- Press
Ctrl+Shift+P
, select Remote-Containers: Open Folder in Container.... - Choose the folder containing
.devcontainer
.
Technical Notes - Python Extensions:ΒΆ
- β
nnthanh101/python:jupyterlab
- βοΈ
nnthanh101/python:techdocs
- β
βοΈ
nnthanh101/python:latest
- βοΈ
nnthanh101/python:cloudops
-
nnthanh101/python:analytics
β | Python Extension | Category | Description | Relevant URL |
---|---|---|---|---|
βοΈ | ansible |
Automation | Configuration management and orchestration tool. | Ansible Docs |
βοΈ | awscli |
Cloud Management | Command-line interface for AWS services. | AWS CLI Docs |
βοΈ | azure-cli |
Cloud Management | Command-line tools for managing Azure resources. | Azure CLI Docs |
βοΈ | boto3 |
Cloud Management | AWS SDK for Python to automate and manage AWS services programmatically. | Boto3 Docs |
MkDocs Extensions | ||||
βοΈ | mkdocs |
Documentation Tools | A static site generator for project documentation. | MkDocs Docs |
βοΈ | mkdocs-material |
Documentation Tools | A modern, responsive theme for MkDocs. | Material Theme |
βοΈ | mkdocstrings |
Documentation Tools | Plugin for documenting Python code using docstrings. | MkDocstrings |
βοΈ | mkdocstrings[python] |
Documentation Tools | Enhanced Python support for mkdocstrings . |
MkDocstrings Python |
βοΈ | mkdocs-drawio-exporter |
Documentation Tools | Export draw.io diagrams to integrate with MkDocs. | DrawIO Exporter |
βοΈ | pymdown-extensions |
Documentation Tools | Markdown extensions for advanced formatting. | Pymdown Extensions |
βοΈ | pygments |
Documentation Tools | Syntax highlighter for MkDocs and other tools. | Pygments Docs |
JupyterLab Ecosystem | ||||
β | ipykernel |
Interactive Computing | Core dependency for running Jupyter Notebook kernels. | IPyKernel Docs |
β | ipywidgets |
Interactive Computing | Interactive widgets for Jupyter. | IPyWidgets Docs |
β | jupyterlab |
Interactive Computing | Web-based interface for interactive Python computing. | JupyterLab Docs |
β | jupyterlab-git |
Interactive Computing | Git integration for JupyterLab. | JupyterLab Git |
β¬ | jupyter-resource-usage |
Interactive Computing | Monitor system resource usage during JupyterLab sessions. | Resource Usage |
β¬ | jupyter_scheduler |
Interactive Computing | Schedule and manage Jupyter Notebook execution tasks. | Jupyter Scheduler |
βοΈ | gunicorn |
Web Application Hosting | Lightweight WSGI server for Python web applications. | Gunicorn Docs |
βοΈ | pandas |
Data Science | Library for data manipulation and analysis. | Pandas Docs |
βοΈ | plotly |
Data Visualization | Interactive and publication-quality data visualization. | Plotly Docs |
βοΈ | vizro |
Data Visualization | Lightweight dashboards for Python data visualization. | Vizro Docs |
Directory StructureΒΆ
.
βββ Dockerfile ## Main Dockerfile for building the image
βββ start.sh ## Startup script to initialize services
βββ starship.sh ## Starship prompt configuration script
βββ .banner.sh ## Custom banner for interactive sessions
βββ alias.sh ## Aliases for general use
βββ .bashrc ## Bash runtime configuration
βββ .config/
β βββ starship.toml ## Starship prompt configuration
βββ Taskfile.yaml ## Taskfile for automation tasks