Docker Containerization Guidelines#

Important

When the Docker Env is ready to use, the details of which are available below, click to continue to the quickstart section Checking the build scikit-plots.

๐Ÿš€ Docker Containerization#

๐Ÿ’ก Work on Docker Desktop or Github Codespaces

Hereโ€™s how containerization works:

  • Isolation: Containers run independently of each other and the host system, ensuring that they donโ€™t interfere with other applications or containers.

  • Portability: Since containers include everything the application needs to run, they can be moved between different environments (like from development to production) without any compatibility issues.

  • Efficiency: Containers are more lightweight than virtual machines (VMs) because they share the host OSโ€™s kernel rather than running their own separate operating system. This makes them faster and more resource-efficient.

  • Consistency: The application inside the container runs the same way regardless of where itโ€™s deployed, ensuring consistency across environments.

Github Codespaces Guide#

(Connect IDE Interface Vscode or Jupyter Notebook)

Choose (recommended) not (default) Option for best practise



Docker Desktop Guide#

## Forked repo: https://github.com/scikit-plots/scikit-plots.git
git clone https://github.com/YOUR-USER-NAME/scikit-plots.git
cd scikit-plots/docker

## Use terminal or open to vscode to run ``docker compose``
code .

Docker Environment Setup for IDE (Vscode/Jupyter) and/or NVIDIA GPU driver

This repository contains Docker & Docker Compose configurations for running Jupyter Notebooks with optional NVIDIA GPU support.

You can run containers with either host-installed CUDA or pre-installed CUDA inside the container.

๐Ÿท๏ธ Docker Compose Quickstart Guide#

๐Ÿ’ก The easiest way to launch the environment is using Docker Compose.#

โ–ถ๏ธ Run Docker Env Jupyter Notebook (CPU only)

docker compose up --build notebook_cpu

โ–ถ๏ธ Run Docker Env Jupyter Notebook (With NVIDIA Host GPU)

docker compose up --build app_nvidia_host_gpu_driver

โ–ถ๏ธ Run Docker Env Jupyter Notebook (With NVIDIA Internal CUDA GPU)

docker compose up --build app_nvidia_internal_gpu_driver

โ–ถ๏ธ Run Docker Env Jupyter Notebook by VS Code#

โ–ถ๏ธ Connect Docker Container Especially When Docker GUI dont available#

# docker-compose up --build notebook_cpu

docker ps  # check running containers
docker logs CONTAINER_ID_OR_NAME  # find jupyter (token) http address 127.0....
docker exec -it CONTAINER_ID_OR_NAME bash  # Connect interactive terminal

โ–ถ๏ธ Run post_create_commands.sh#

# bash .devcontainer/script/post_create_commands.sh
bash docker/script/post_create_commands.sh  # (not needed every time)

โ–ถ๏ธ Run setup_vscode_ext.sh#

# (Optionally) vscode_ext
bash docker/script/setup_vscode_ext.sh  # (not needed every time)

๐Ÿšฏ Stop Containers#

docker compose down

๐Ÿณ Docker Compose Configuration#

This project is based on Docker Compose and includes multiple services:

๐Ÿ”น notebook_cpu (CPU-Only)

Runs Jupyter Notebook using jupyter/tensorflow-notebook:latest

No CUDA support, best for lightweight tasks

Mounts the local folder scikit-plots to /home/jovyan/work

Runs on port 8888

๐Ÿ”น app_nvidia_host_gpu_driver (Uses Host CUDA)

Runs Jupyter Notebook using jupyter/tensorflow-notebook:latest

Uses host-installed CUDA for GPU acceleration

Requires NVIDIA runtime enabled (โ€“runtime=nvidia)

Runs on port 8889

๐Ÿ”น app_nvidia_internal_gpu_driver (CUDA Inside Container)

Runs nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 with pre-installed CUDA

Includes NVIDIA GPU support without needing host CUDA

Requires NVIDIA runtime (โ€“runtime=nvidia)

Runs on port 8890

๐Ÿ› ๏ธ Custom Docker Commands#

If you need more control, you can use Docker CLI commands.

โ–ถ๏ธ Build & Run the Container Manually

docker build -t my-custom-container -f docker/Dockerfile .
docker run -it --rm -p 8888:8888 my-custom-container

โ–ถ๏ธ Check GPU Availability Inside Container

docker exec -it <container_id> nvidia-smi

๐Ÿ“‚ Folder Structure#

docker/
โ”œโ”€โ”€ docker-compose.yml              # Primary Docker Compose file
โ”œโ”€โ”€ docker-compose.override.yml     # Optional override file (auto-included if present)
โ”œโ”€โ”€ Dockerfile                      # Custom Dockerfile
โ”œโ”€โ”€ script/
โ”‚   โ”œโ”€โ”€ install_gpu_nvidia_cuda.sh  # GPU setup script

๐Ÿ–ฅ๏ธ Useful References#

๐Ÿ“š Jupyter Docker Stacks: Read the Docs

๐Ÿ“š Docker Compose: Official Docs

๐Ÿ“š Dockerfile Best Practices

๐Ÿ“š LocalStack Installation with Docker Compose

๐Ÿ“š NVIDIA CUDA in Containers: NVIDIA Docs

https://developer-blogs.nvidia.com/wp-content/uploads/2016/06/nvidia-docker.png

๐Ÿš€ Now youโ€™re ready to run Jupyter notebooks in Docker! ๐Ÿ˜Š