Skip to main content

CloudOps Docker Container

ยท 4 min read
DevOps
DevOps Engineer

Overviewโ€‹

The nnthanh101/runbooks:latest 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 CloudOps, FinOps, Analytics, AI, 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 MkDocs, JupyterLab, and Vizro for documentation and analytics workflows.

Key Featuresโ€‹

  • Lightweight and Secure:

    • Built on cgr.dev/chainguard/wolfi-base:latest, prioritizing security with minimal attack surface.
    • Non-root os user pre-configured to ensure security.
    • Cross-Platform Support: Supports multiple architectures, including linux/amd64 and linux/arm64.
    Chainguard's Wolfi Docker Images
  • Cloud-Native Utilities: Pre-installed tools like starship, task, git-lfs, and support for pre-configured Python 3.12 virtual environment support for compatibility with modern workflows. Integrated also with awscli, azure-cli, and ansible 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/runbooks:latest bash
export HOME_AWS="$HOME/.aws"

docker run -it --rm -p 8888:8888 \
-v "$(pwd):/workspace:rw" \
-v "${HOST_AWS}:/workspace/.aws:ro" \
nnthanh101/runbooks:latest

Run with Data Mountingโ€‹

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/runbooks:latest

Use for JupyterLabโ€‹

USERNAME=os

docker run -it -p 8888:8888 \
-v $HOME/notebooks:/home/$USERNAME/notebooks \
nnthanh101/runbooks:latest jupyter lab --ip=0.0.0.0 --no-browser

Extend the Imageโ€‹

To add custom Python packages:

FROM nnthanh101/runbooks:latest

COPY requirements.txt /home/os/requirements.txt
RUN pip install --no-cache-dir -r /home/os/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:

    1. Open the project folder in VS Code.
    2. Press Ctrl+Shift+P, select Remote-Containers: Open Folder in Container....
    3. Choose the folder containing .devcontainer.

Technical Notes - Python Extensions:โ€‹

  • โœ… runbooks:jupyterlab
  • โ˜‘๏ธ runbooks:techdocs
  • โœ”๏ธ runbooks:cloudops
โœ…Python ExtensionCategoryDescriptionRelevant URL
โœ”๏ธansibleInfra AutomationConfiguration management and orchestration tool.Ansible Docs
โœ”๏ธawscliCloud ManagementCommand-line interface for AWS services.AWS CLI Docs
โœ”๏ธazure-cliCloud ManagementCommand-line tools for managing Azure resources.Azure CLI Docs
โœ”๏ธboto3Cloud ManagementAWS SDK for Python to automate and manage AWS services programmatically.Boto3 Docs
MkDocs and Extensions
โ˜‘๏ธmkdocsDocumentation ToolsA static site generator for project documentation.MkDocs Docs
โ˜‘๏ธmkdocs-materialDocumentation ToolsA modern, responsive theme for MkDocs.Material Theme
โ˜‘๏ธmkdocstringsDocumentation ToolsPlugin for documenting Python code using docstrings.MkDocstrings
โ˜‘๏ธmkdocstrings[python]Documentation ToolsEnhanced Python support for mkdocstrings.MkDocstrings Python
โ˜‘๏ธmkdocs-drawio-exporterDocumentation ToolsExport draw.io diagrams to integrate with MkDocs.DrawIO Exporter
โ˜‘๏ธpymdown-extensionsDocumentation ToolsMarkdown extensions for advanced formatting.Pymdown Extensions
โ˜‘๏ธpygmentsDocumentation ToolsSyntax highlighter for MkDocs and other tools.Pygments Docs
JupyterLab Ecosystem
โœ…gunicornWeb Application HostingLightweight WSGI server for Python web applications.Gunicorn Docs
โœ…ipykernelInteractive ComputingCore dependency for running Jupyter Notebook kernels.IPyKernel Docs
โœ…ipywidgetsInteractive ComputingInteractive widgets for Jupyter.IPyWidgets Docs
โœ…jupyterlabInteractive ComputingWeb-based interface for interactive Python computing.JupyterLab Docs
โœ…jupyterlab-gitInteractive ComputingGit integration for JupyterLab.JupyterLab Git
โฌœjupyter-resource-usageInteractive ComputingMonitor system resource usage during JupyterLab sessions.Resource Usage
โฌœjupyter_schedulerInteractive ComputingSchedule and manage Jupyter Notebook execution tasks.Jupyter Scheduler
โœ”๏ธpandasData ScienceLibrary for data manipulation and analysis.Pandas Docs
โœ”๏ธplotlyData VisualizationInteractive and publication-quality data visualization.Plotly Docs
โœ”๏ธvizroData VisualizationLightweight dashboards for Python data visualization.Vizro Docs