Documentation for Docker Installation and Usage 1.0 documentation

Welcome to the user manual for setting up and using Docker on a Windows system. This guide will provide comprehensive instructions to help you install and configure Docker Desktop on Windows, activate virtualization in BIOS, install WSL (Windows Subsystem for Linux), import Docker images, mount user data, and run Docker containers. Additionally, it includes pointers and tips to address common questions and issues that users may encounter.

To enable virtualization, you'll need to access the BIOS settings during startup. Here’s how:

To enable virtualization, you’ll need to access the BIOS settings during startup. Here’s how:

When you see the screen, press the ``F2 / F10 / F12 / Esc / Delete / Enter`` key to enter the BIOS settings.

..  figure:: images/B1.jpg
    :width: 900
    :align: center

    Screen when we boot up the machine. Press ``F2 / F10 / F12 / Esc / Delete / Enter``

Screen when we boot up the machine. Press ``F2 / F10 / F12 / Esc / Delete / Enter``

Navigate through the BIOS menus using the arrow keys. Look for the section typically labeled ``Advanced``, ``Advanced Settings`` or ``CPU Configuration``.

Navigate through the BIOS menus using the arrow keys. Look for the section typically labeled 

Alternatively, some BIOS versions allow you to search for settings. Look for a search bar or a similar feature where you can type ``virtualization`` or ``VT-x`` (for Intel processors) / ``AMD-V`` (for AMD processors).

Alternatively, some BIOS versions allow you to search for settings. Look for a search bar or a similar feature where you can type 

..  figure:: images/B3.jpg

    BIOS settings screen.

Once you locate the virtualization options within these sections, you can proceed to enable them. This step is crucial for utilizing virtualization features such as running virtual machines or other virtualization-based applications on your computer. After making the necessary changes, remember to save your settings and exit the BIOS.

Change the setting from ``Disabled`` to ``Enabled`` using the appropriate key (usually ``Enter`` or the ``+`` key).

..  figure:: images/B2.jpg

    Turn on Virtualization.

Here are the simplified instructions for installing Windows Subsystem for Linux (WSL) and verifying its installation:

**Install WSL:**
Run the following command to install WSL: ``wsl --install``.
Follow any prompts or confirmations that appear during the installation process.

.

**Wait for Installation to Complete:**
Allow the installation process to finish. This may take some time depending on your internet speed.

..  figure:: images/W3.png
    :width: 1200

    Install Windows Subsystem for Linux (WSL)

**Check WSL Version:**
Run the following command to check the installed WSL versions and their respective distributions: ``wsl -l -v``
This command lists all installed Linux distributions and their associated WSL versions (`1` or `2`).

Run the following command to check the installed WSL versions and their respective distributions: 

This command lists all installed Linux distributions and their associated WSL versions (

..  figure:: images/W4.png

    Check if WSL is properly installed

Following these steps ensures that you install Windows Subsystem for Linux (WSL) and confirm its proper installation on your Windows system.

Download Docker Desktop from `Docker's official website <https://www.docker.com/get-started/>`_ (https://www.docker.com/get-started/).

`Docker's official website <https://www.docker.com/get-started/>`_

..  figure:: images/W5.png

    Download Docker Desktop online

Once downloaded, locate the installer file (e.g., ``DockerDesktopInstaller.exe``) and double-click to launch it.

Follow the prompts provided by the Docker Desktop installer to complete the installation process. This may involve accepting terms and conditions and choosing installation preferences.

..  figure:: images/W6.png

    Docker Desktop Installer

..  figure:: images/W7.png

    Installing Docker Desktop

..  figure:: images/W8.png

    Finish installing Docker Desktop

After installation, a Docker Desktop shortcut will appear on your desktop. The necessary components to run Maxwell-TD Docker images include Docker Desktop itself, Windows PowerShell for running CLI commands, and a designated working folder containing Docker images and user data (e.g., geometry information).

..  figure:: images/W9.png
    :width: 300

    All the data/folders/apps needed to run Maxwell-TD Docker image

Launch Docker Desktop by double-clicking the Docker Desktop shortcut on your desktop.

Upon first launch, Docker Desktop may prompt you to accept terms and conditions. Agree to proceed with using the application.

..  figure:: images/W10.png

    Accept the terms and conditions

You can continue without logging into Docker Desktop if prompted, and optionally skip any survey presented during initial setup.

..  figure:: images/W11.png

    Continue without logging in

..  figure:: images/W12.png

    Skip Survey

Currently, the local repository in Docker Desktop is empty. To proceed, we must upload the compiled image for Maxwell-TD. This requires using the PowerShell console, as the GUI does not support managing local Docker images directly and defaults to searching online repositories for Docker images.

..  figure:: images/W13.png

    Image local Repository

Next, we need to mount the zipped Docker image onto the Windows system. Since this action cannot be performed using the Docker Desktop GUI, we'll need to use the console terminal instead.

Next, we need to mount the zipped Docker image onto the Windows system. Since this action cannot be performed using the Docker Desktop GUI, we’ll need to use the console terminal instead.

In the designated working folder, you will find a zipped Docker image file and an "examples" folder containing user-defined data.

In the designated working folder, you will find a zipped Docker image file and an “examples” folder containing user-defined data.

..  figure:: images/W14.png

    Location of Maxwell-TD Docker Image (Zipped)

To load the Docker image, execute the command ``docker load --input <PATH to zipped docker image>``. This process will take some time, and you can verify its completion by using ``docker images`` in the console.

. This process will take some time, and you can verify its completion by using 

..  figure:: images/W16.png

    Load and check Docker Image

The loaded Docker image will also be visible both in Docker Desktop.

..  figure:: images/W17.png

    Loaded Docker Image can be seen in Docker Desktop

Finally, we are ready to run the Docker image. You can use a PowerShell script with administrative privileges to execute the Docker image. We have prepared a script file named ``runDocker.ps1`` that can be executed in the console terminal.

Finally, we are ready to run the Docker image. You can use a PowerShell script with administrative privileges to execute the Docker image. We have prepared a script file named 

To run the script and start the Docker image, follow these steps:

**Navigate to Script Directory:**
Use the ``cd`` command to navigate to the directory where ``runDocker.ps1`` is located.

**Execute the Script:**
 - Run the script by typing ``.\runDocker.ps1`` and press ``Enter``.
 - The script will mount the folder containing user-defined data into the Docker Server environment.

- Run the script by typing ``.\runDocker.ps1`` and press ``Enter``.
- The script will mount the folder containing user-defined data into the Docker Server environment.

Run the script by typing ``.\runDocker.ps1`` and press ``Enter``.

The script will mount the folder containing user-defined data into the Docker Server environment.

- When running the Docker image, any data saved onto the mounted filesystem will persist. However, other modifications, such as custom installations of packages, will be temporary and will disappear after you exit the Docker session.
- Treat the Docker image as a saved state of a customized environment.

When running the Docker image, any data saved onto the mounted filesystem will persist. However, other modifications, such as custom installations of packages, will be temporary and will disappear after you exit the Docker session.

Treat the Docker image as a saved state of a customized environment.

..  figure:: images/W18.png

    Use PowerShell Script to run Docker Image

Let's break down the lines in the PowerShell script to understand the necessary steps for running the Docker image. This will clarify what is needed for execution.

Let’s break down the lines in the PowerShell script to understand the necessary steps for running the Docker image. This will clarify what is needed for execution.

This variable defines the name of the Docker image that you want to run. In this case, it is set to ``maxwell_td_image``. Users should not change this variable if they intend to run Maxwell-TD.

This variable defines the name of the Docker image that you want to run. In this case, it is set to 

. Users should not change this variable if they intend to run Maxwell-TD.

This variable specifies the name of the container that will run the Docker image. You can run multiple containers from the same image concurrently, so each running instance needs a unique name. Users can customize this variable to suit their naming conventions.

This variable holds the path to the working folder on the Windows system. This folder contains essential files such as geometry files for simulation models and scripts for setting simulation parameters. Users must update this path to point to their specific working folder.

This variable defines the path within the Docker container (running on Linux environment) where the host volume (**$hostVolumePath**) will be mounted. In this script, it is set to ``/dgtd/model/``. It is recommended that users do not change this variable unless necessary, to ensure compatibility with the Docker image's expected mount point.

This variable defines the path within the Docker container (running on Linux environment) where the host volume (

. It is recommended that users do not change this variable unless necessary, to ensure compatibility with the Docker image’s expected mount point.

..  figure:: images/W20.png

    User-defined parameters to change location of User data

Next, the script proceeds to execute several commands to display the paths and names. It also checks the CUDA version installed on the Windows device. Afterward, it runs the Docker command ``docker run --rm --gpus all -it --name ${containerName} -v ${hostVolumePath}:${containerVolumePath} ${imageName}``.

Next, the script proceeds to execute several commands to display the paths and names. It also checks the CUDA version installed on the Windows device. Afterward, it runs the Docker command 

``docker run --rm --gpus all -it --name ${containerName} -v ${hostVolumePath}:${containerVolumePath} ${imageName}``

docker run --rm --gpus all -it --name ${containerName} -v ${hostVolumePath}:${containerVolumePath} ${imageName}

**Explanation of Docker Command Flags**
- ``docker run``: This command starts a new Docker container.
- ``--rm``: Automatically removes the container when it exits. Useful for temporary containers.
- ``--gpus all``: Enables access to all GPUs in the container.
- ``-it``: Allocates a pseudo-TTY and keeps stdin open. Allows interactive terminal access.
- ``--name ${containerName}``: Assigns a name to the container instance based on the value stored in the ``$containerName`` variable.
- ``-v ${hostVolumePath}:${containerVolumePath}``: Mounts a volume from the host machine (Windows) into the Docker container. ``${hostVolumePath}`` is the path on the host system, and ``${containerVolumePath}`` is the path inside the container where the volume will be mounted.
- ``${imageName}``: Specifies the Docker image to use for creating the container.

``--rm``: Automatically removes the container when it exits. Useful for temporary containers.

: Automatically removes the container when it exits. Useful for temporary containers.

``-it``: Allocates a pseudo-TTY and keeps stdin open. Allows interactive terminal access.

: Allocates a pseudo-TTY and keeps stdin open. Allows interactive terminal access.

``--name ${containerName}``: Assigns a name to the container instance based on the value stored in the ``$containerName`` variable.

: Assigns a name to the container instance based on the value stored in the 

``-v ${hostVolumePath}:${containerVolumePath}``: Mounts a volume from the host machine (Windows) into the Docker container. ``${hostVolumePath}`` is the path on the host system, and ``${containerVolumePath}`` is the path inside the container where the volume will be mounted.

: Mounts a volume from the host machine (Windows) into the Docker container. 

 is the path inside the container where the volume will be mounted.

``${imageName}``: Specifies the Docker image to use for creating the container.

**Additional Information**
- The ``--rm`` flag ensures that the container is automatically removed after it stops running, helping to manage resources efficiently.
- ``--gpus all`` allows the Docker container to access all available GPUs on the host machine, which is crucial for applications that require GPU acceleration.
- ``-it`` enables interactive mode with a terminal session, which is useful for interacting directly with the container if needed.

The ``--rm`` flag ensures that the container is automatically removed after it stops running, helping to manage resources efficiently.

 flag ensures that the container is automatically removed after it stops running, helping to manage resources efficiently.

``--gpus all`` allows the Docker container to access all available GPUs on the host machine, which is crucial for applications that require GPU acceleration.

 allows the Docker container to access all available GPUs on the host machine, which is crucial for applications that require GPU acceleration.

``-it`` enables interactive mode with a terminal session, which is useful for interacting directly with the container if needed.

 enables interactive mode with a terminal session, which is useful for interacting directly with the container if needed.

This Docker command, when executed within the PowerShell script, sets up and runs the Docker container named ``${containerName}`` with GPU support, mounts necessary volumes, and utilizes the specified Docker image ``${imageName}`` for the Maxwell-TD application. Adjust ``${containerName}``, ``${hostVolumePath}``, ``${containerVolumePath}``, and ``${imageName}`` as per your specific environment and requirements.

This Docker command, when executed within the PowerShell script, sets up and runs the Docker container named 

 with GPU support, mounts necessary volumes, and utilizes the specified Docker image 

..  figure:: images/W21.png

    Commands to run Docker image

When opening a Windows text file in a Unix environment, extra ``\r`` characters at the end of each line can cause errors such as ``/bin/bash^M: bad interpreter: No such file or directory``. This is because Unix-based systems expect lines to end with ``\n`` (newline) instead of ``\r\n`` (carriage return followed by newline) used in Windows.

To fix this issue, you can convert the line endings from Windows format to Unix format using utilities like ``dos2unix``, which removes the extra ``\r`` characters. Alternatively, you can use the included function ``Remove-CarriageReturns`` in ``runDocker.ps1`` to process the files. Once corrected, your script should execute correctly within Docker or any Unix-based environment without encountering interpreter errors.

To fix this issue, you can convert the line endings from Windows format to Unix format using utilities like 

 to process the files. Once corrected, your script should execute correctly within Docker or any Unix-based environment without encountering interpreter errors.

..  figure:: images/W19.png

    Miscellaneous function to treat textfiles from Windows System (Optional)

Miscellaneous function to treat textfiles from Windows System (Optional)

To run the script, navigate to the directory where ``runDocker.ps1`` is located and execute ``./runDocker.ps1``. The script will display the CUDA toolkit version and open a BASH shell in the Docker container with ``maxwell_td_image``. This environment simulates a Linux environment.

. The script will display the CUDA toolkit version and open a BASH shell in the Docker container with 

..  figure:: images/W27.png

    Running PowerShell Script

Upon starting the Docker container, you will be in the ``/dgtd/`` directory, where the Discontinuous Galerkin Time-Domain (DGTD) code is located. The compiled code can be found in the ``/dgtd/build/`` directory, with the executables named ``maxwelltd_CUDA_LTS_DOUBLEpre_FLOATpro`` and ``maxwelltd_CUDA_LTS_DOUBLEpre_FLOATpro-``. User data, mounted from the Windows filesystem, is available in the ``/dgtd/model/`` directory. Before running the simulation, the compiled executable must be copied to the simulation folder (``/dgtd/model/MaxwellTD_data/``). This can be done by executing the following command:

 directory, where the Discontinuous Galerkin Time-Domain (DGTD) code is located. The compiled code can be found in the 

. User data, mounted from the Windows filesystem, is available in the 

 directory. Before running the simulation, the compiled executable must be copied to the simulation folder (

..  figure:: images/W29.png

    Local Directory in Docker Image

Simulation files for the MaxwellTD model are located in the directory ``/dgtd/model/MaxwellTD_data``. Additionally, we have included CST reference data for the same simulation model in the folder ``CST_data``. A Python script named ``compare_maxwelltd_CST.py`` has been provided to facilitate extraction and comparison of data between the DGTD simulation and CST data.

Simulation files for the MaxwellTD model are located in the directory 

. Additionally, we have included CST reference data for the same simulation model in the folder 

 has been provided to facilitate extraction and comparison of data between the DGTD simulation and CST data.

..  figure:: images/W31a.png

    Simulation folder

To run the DGTD simulation, we can navigate to ``/dgtd/model/MaxwellTD_data/`` and run the shell script ``CUDA_LTS_RUN.sh``.

..  figure:: images/W45.png

    Running Simulation script

..  figure:: images/W46.png

    Simulating running

..  figure:: images/W47.png

    End of simulation

Following the completion of the simulation, you can execute the Python script ``compare_maxwelltd_CST.py`` to compare the results with those obtained from the CST simulation.

Following the completion of the simulation, you can execute the Python script 

 to compare the results with those obtained from the CST simulation.

..  figure:: images/W49.png

    Running post-processing PYTHON script

It's essential to verify that your Windows device has the correct CUDA toolkit installed to run Maxwell-TD. You can check the CUDA toolkit version by using 'nvidia-smi' in the console terminal. The minimum required version to run Maxwell-TD is CUDA toolkit 12.4.

It’s essential to verify that your Windows device has the correct CUDA toolkit installed to run Maxwell-TD. You can check the CUDA toolkit version by using ‘nvidia-smi’ in the console terminal. The minimum required version to run Maxwell-TD is CUDA toolkit 12.4.

..  figure:: images/W22.png

    Check CUDA toolkit version

If you need to update your CUDA toolkit, you can visit the `NVIDIA website <https://developer.nvidia.com/cuda-toolkit>`_ (https://developer.nvidia.com/cuda-toolkit). Click on 'NVIDIA CUDA Toolkit Download' to access the latest version. Alternatively, if you require an earlier version, you can navigate to 'Archive of Previous CUDA Releases' on the NVIDIA website to find the specific CUDA toolkit version you need.

). Click on ‘NVIDIA CUDA Toolkit Download’ to access the latest version. Alternatively, if you require an earlier version, you can navigate to ‘Archive of Previous CUDA Releases’ on the NVIDIA website to find the specific CUDA toolkit version you need.

..  figure:: images/W23.png

    NVIDIA website to download CUDA toolkit

..  figure:: images/W24.png

    NVIDIA CUDA toolkit download

..  figure:: images/W25.png

    NVIDIA CUDA toolkit (Latest version)

..  figure:: images/W26.png

    NVIDIA CUDA toolkit (Earlier versions)

Follow the download and installation instructions provided on the NVIDIA website to update or install the CUDA toolkit on your Windows device. This ensures that Maxwell-TD and other CUDA-dependent applications can function correctly.

Make sure your Windows 10 or 11 system meets the following requirements:

**Windows 11:** 64-bit Home or Pro version 21H2 or later, or Enterprise or Education version 21H2 or later.

 64-bit Home or Pro version 21H2 or later, or Enterprise or Education version 21H2 or later.

**Windows 10:** 64-bit Home or Pro version 22H2 (build 19045) or later, or Enterprise or Education version 22H2 (build 19045) or later. The minimum supported version is Home or Pro 21H2 (build 19044) or later, or Enterprise or Education 21H2 (build 19044) or later.

 64-bit Home or Pro version 22H2 (build 19045) or later, or Enterprise or Education version 22H2 (build 19045) or later. The minimum supported version is Home or Pro 21H2 (build 19044) or later, or Enterprise or Education 21H2 (build 19044) or later.

- Docker Desktop on Windows is supported only on versions of Windows that are still actively serviced by Microsoft. It is not compatible with Windows Server versions like Windows Server 2019 or Windows Server 2022.
- Containers and images created with Docker Desktop are shared across all user accounts on the same machine, as they use a common VM for building and running containers. However, sharing containers and images between user accounts is not supported when using the Docker Desktop WSL 2 backend.

Docker Desktop on Windows is supported only on versions of Windows that are still actively serviced by Microsoft. It is not compatible with Windows Server versions like Windows Server 2019 or Windows Server 2022.

Containers and images created with Docker Desktop are shared across all user accounts on the same machine, as they use a common VM for building and running containers. However, sharing containers and images between user accounts is not supported when using the Docker Desktop WSL 2 backend.

Make sure your system has adequate storage space for the image. The current image requires 10GB for storage while zipped. Once extracted, it occupies an additional 10GB on your system, although it remains hidden from regular users. You can view these hidden images and containers using Docker Desktop.

..  figure:: images/W42.png

    View all containers or image on Docker Desktop

Users can remove any unwanted images or containers using the 'delete' button.

Users can remove any unwanted images or containers using the ‘delete’ button.

..  figure:: images/W43.png

    Delete if not needed to free up space

If necessary, resort to command-line operations to reclaim system resources. Execute these commands in a PowerShell console with administrative privileges.

# Purging All Unused or Dangling Resources
docker system prune

# Remove stopped containers and all unused images
docker system prune -a

# Removing Docker Images

## Remove Specific Images
# List all images (including intermediate layers)
docker images -a

# Remove specific image(s) using their ID or tag
docker rmi <image_id_or_name>

## Remove Dangling Images
# List dangling images
docker images -f dangling=true

# Remove dangling images
docker image prune

## Remove Images Matching a Pattern
# List images matching a pattern (using grep)
docker images -a | grep "pattern"

# Remove images matching a pattern using awk and xargs
docker images -a | grep "pattern" | awk '{print $1":"$2}' | xargs docker rmi

## Remove All Images
# Remove all Docker images
docker rmi $(docker images -a -q)

# Removing Containers

## Remove Specific Containers
# List all containers (including stopped ones)
docker ps -a

# Remove specific container(s)
docker rm <container_id_or_name>

## Remove All Exited Containers
# List all exited containers
docker ps -a -f status=exited

# Remove all exited containers
docker rm $(docker ps -a -f status=exited -q)

## Remove Containers Matching a Pattern
# List containers matching a pattern (using grep)
docker ps -a | grep "pattern"

# Remove containers matching a pattern using awk and xargs
docker ps -a | grep "pattern" | awk '{print $1}' | xargs docker rm

## Stop and Remove All Containers
# Stop all containers
docker stop $(docker ps -a -q)

# Remove all containers
docker rm $(docker ps -a -q)

To enable Docker server virtualization on Windows, it's crucial to ensure that virtualization is enabled in your computer's BIOS settings. This setting can only be modified by restarting your machine and accessing the BIOS configuration. Virtualization support in BIOS allows Windows to utilize Docker server features effectively. It's a necessary step to ensure Docker containers run efficiently on your system.

To enable Docker server virtualization on Windows, it’s crucial to ensure that virtualization is enabled in your computer’s BIOS settings. This setting can only be modified by restarting your machine and accessing the BIOS configuration. Virtualization support in BIOS allows Windows to utilize Docker server features effectively. It’s a necessary step to ensure Docker containers run efficiently on your system.

To modify simulation parameters, you can edit the ``CUDA_LTS_RUN.sh`` shell script. This script contains flags or variables that control various aspects of the DGTD simulation. The script includes comments or descriptions to explain the variables' or flags' purpose.

 shell script. This script contains flags or variables that control various aspects of the DGTD simulation. The script includes comments or descriptions to explain the variables’ or flags’ purpose.

echo "==========="
echo "EXECUTABLE"
EXE="./maxwelltd_CUDA_LTS_DOUBLEpre_FLOATpro"
echo $EXE
echo "FileName"

# 0. [EXE]
# 1. Filename: Simulation Filename
# 2. Freq: Central Modulation Frequency (MHz)
# 3. Planewave Waveform (Excitation Type): (0)Time Harmonic (1)Gauss (2)Neumann (3) Modulated Gauss;
# 4. Port Waveform (0) Time Harmonic Pulse (1) Gaussian Pulse
# 5. Tdelay: Delay of excitation pulse (sec)
# 6. Tau: Width of pulse (sec)
# 7. FinalTime: Termination Time (sec)
# 8. Gamma (Penalty) --> 1 upwind , 0 central
# 9. VTU --> 0 (YES), 1 (NO)
#10. Surface Field Output BC Surfaces  --> (0) Off (1) PEC only (2) FieldPlane only (3) FieldPlane and PEC
#11. Surface Output Types --> (0) Field (1) Current (2) Field and Current
#12. Poly order --> (1) First Order (2) Second Order
#13. Free Space Comparison(Analytical): (0) True and (1) False
#14. SAMPLINGRATE : parameter of Pade approximation
#15. PADE : (0) Pade mode is Off (2) Pade mode is on

FILENAME=cylinder_cr1.75
FREQ=2650
PLANEWAVEFLAG=1
PORTFLAG=1
TD=2.5e-9
TAU=2.5e-10
FINALTIME=25e-8
GAMMA=0.025
VTU=1
SURFFIELDOUTBCSURFS=0
SURFOUTTYPES=0
POLYORDER=2
ANALYTICAL=1
SAMPLINGRATE=12.5
PADE=2

rm *.log
rm *.vtu
rm AnalyticalIncidentField*
rm Probes_*
rm *.TD*
rm -r ./TimeDomainVoltages
$EXE $FILENAME $FREQ $PLANEWAVEFLAG $PORTFLAG $TD $TAU $FINALTIME $GAMMA $VTU $SURFFIELDOUTBCSURFS $SURFOUTTYPES $POLYORDER $ANALYTICAL $SAMPLINGRATE $PADE | tee -a compute.log
rm -r ./VTU_LTS
mkdir ./VTU_LTS
mv *.vtu ./VTU_LTS
rm -r ./PROBES
mkdir ./PROBES
mv *.csv ./PROBES
mv *.TD* ./PROBES
mv *.log ./PROBES

Docker Engine is a powerful tool that simplifies the process of creating, deploying, and managing applications using containers. Here's an introduction to Docker Engine and its basic functionalities:

Docker Engine is a powerful tool that simplifies the process of creating, deploying, and managing applications using containers. Here’s an introduction to Docker Engine and its basic functionalities:

Docker Engine is the core component of Docker, a platform that enables developers to package applications and their dependencies into lightweight containers. These containers can then be deployed consistently across different environments, whether it's a developer's laptop, a testing server, or a production system.

Docker Engine is the core component of Docker, a platform that enables developers to package applications and their dependencies into lightweight containers. These containers can then be deployed consistently across different environments, whether it’s a developer’s laptop, a testing server, or a production system.

**Containerization:** Docker Engine allows you to create and manage containers, which are isolated environments that package an application and its dependencies. Containers ensure consistency in runtime environments across different platforms.

 Docker Engine allows you to create and manage containers, which are isolated environments that package an application and its dependencies. Containers ensure consistency in runtime environments across different platforms.

**Image Management:** Docker uses images as templates to create containers. Docker Engine allows you to build, push, and pull images from Docker registries (like Docker Hub or private registries). Images are typically defined using a Dockerfile, which specifies the environment and setup instructions for the application.

 Docker uses images as templates to create containers. Docker Engine allows you to build, push, and pull images from Docker registries (like Docker Hub or private registries). Images are typically defined using a Dockerfile, which specifies the environment and setup instructions for the application.

**Container Lifecycle Management:** Docker Engine provides commands to start, stop, restart, and remove containers. It also manages the lifecycle of containers, including monitoring their status and resource usage.

 Docker Engine provides commands to start, stop, restart, and remove containers. It also manages the lifecycle of containers, including monitoring their status and resource usage.

**Networking:** Docker Engine facilitates networking between containers and between containers and the outside world. It provides mechanisms for containers to communicate with each other and with external networks, as well as configuring networking options like ports and IP addresses.

 Docker Engine facilitates networking between containers and between containers and the outside world. It provides mechanisms for containers to communicate with each other and with external networks, as well as configuring networking options like ports and IP addresses.

**Storage Management:** Docker Engine manages storage volumes that persist data generated by containers. It supports various storage drivers and allows you to attach volumes to containers, enabling data persistence and sharing data between containers and the host system.

 Docker Engine manages storage volumes that persist data generated by containers. It supports various storage drivers and allows you to attach volumes to containers, enabling data persistence and sharing data between containers and the host system.

**Resource Isolation and Utilization:** Docker Engine uses Linux kernel features (such as namespaces and control groups) to provide lightweight isolation and resource utilization for containers. This ensures that containers run efficiently without interfering with each other or with the host system.

 Docker Engine uses Linux kernel features (such as namespaces and control groups) to provide lightweight isolation and resource utilization for containers. This ensures that containers run efficiently without interfering with each other or with the host system.

**Integration with Orchestration Tools:** Docker Engine can be integrated with orchestration tools like Docker Swarm and Kubernetes for managing containerized applications at scale. Orchestration tools automate container deployment, scaling, and load balancing across multiple hosts.

 Docker Engine can be integrated with orchestration tools like Docker Swarm and Kubernetes for managing containerized applications at scale. Orchestration tools automate container deployment, scaling, and load balancing across multiple hosts.

**Consistency:** Docker ensures consistency between development, testing, and production environments by encapsulating applications and dependencies into containers.

 Docker ensures consistency between development, testing, and production environments by encapsulating applications and dependencies into containers.

**Efficiency:** Containers are lightweight and share the host system's kernel, reducing overhead and improving performance compared to traditional virtual machines.

 Containers are lightweight and share the host system’s kernel, reducing overhead and improving performance compared to traditional virtual machines.

**Portability:** Docker containers can run on any platform that supports Docker, making it easy to move applications between different environments.

 Docker containers can run on any platform that supports Docker, making it easy to move applications between different environments.

**Isolation:** Containers provide a level of isolation that enhances security and stability, as each container operates independently of others on the same host.

 Containers provide a level of isolation that enhances security and stability, as each container operates independently of others on the same host.

Create a **Dockerfile** that provides instructions to build Docker image.

..  figure:: images/P4.png

    Placing Dockerfile in the directory where we want to create Docker image

Placing Dockerfile in the directory where we want to create Docker image

We're creating a Docker image by starting from an existing Docker image that includes a UNIX environment with CUDA runtime. Initially, we pull the base image from Docker's official repository. Specifically, we can locate suitable base images by searching on `Docker Hub <https://hub.docker.com/search?q=nvidia%2Fcuda>`_ (https://hub.docker.com/search?q=nvidia%2Fcuda).

We’re creating a Docker image by starting from an existing Docker image that includes a UNIX environment with CUDA runtime. Initially, we pull the base image from Docker’s official repository. Specifically, we can locate suitable base images by searching on 

# -----------------------------------------------------------------------------------------
# Step 1 : Import a base image from online repository
# FROM nvidia/cuda:12.5.0-devel-ubuntu22.04
FROM nvidia/cuda:12.4.0-devel-ubuntu22.04

..  figure:: images/docker.png

    Find base images online via `Docker Hub <https://hub.docker.com/search?q=nvidia%2Fcuda>`

Find base images online via `Docker Hub <https://hub.docker.com/search?q=nvidia%2Fcuda>`

In addition, setting ``ENV DEBIAN_FRONTEND=noninteractive`` in a Dockerfile is a directive that adjusts the environment variable ``DEBIAN_FRONTEND`` within the Docker container during the image build process.

 in a Dockerfile is a directive that adjusts the environment variable 

Debian-based Linux distributions, including many Docker base images, use DEBIAN_FRONTEND to determine how certain package management tools (like apt-get) interact with users.
Setting DEBIAN_FRONTEND=noninteractive tells these tools to run in a non-interactive mode. In this mode, the tools assume default behavior for prompts that would normally require user input, such as during package installation or configuration.

During Docker image builds, it's crucial to automate as much as possible to ensure consistency and reproducibility.
Without setting DEBIAN_FRONTEND=noninteractive, package installations might prompt for user input (e.g., to confirm installation, choose configuration options). This interaction halts the build process unless explicitly handled in advance.

During Docker image builds, it’s crucial to automate as much as possible to ensure consistency and reproducibility.

In Dockerfiles, especially those designed for automated builds (CI/CD pipelines, batch processes), it's typical to include ENV DEBIAN_FRONTEND=noninteractive early on. This ensures that subsequent commands relying on package management tools proceed without waiting for user input.

In Dockerfiles, especially those designed for automated builds (CI/CD pipelines, batch processes), it’s typical to include ENV DEBIAN_FRONTEND=noninteractive early on. This ensures that subsequent commands relying on package management tools proceed without waiting for user input.

# Step 2 : Suppress Interactive Prompts from Debian
ENV DEBIAN_FRONTEND=noninteractive

Next, we will need to install packages, libraries and set the environment variables that we need to compile or run Maxwell-TD.

his Dockerfile snippet outlines steps for setting up a Docker image with various libraries and tools typically required for scientific computing and development environments. Let's break down each part:

his Dockerfile snippet outlines steps for setting up a Docker image with various libraries and tools typically required for scientific computing and development environments. Let’s break down each part:

**Update system and install libraries**
  - **Purpose**: Updates the package list and installs a set of essential libraries and tools required for compiling and building various applications.
  - **Packages Installed**:
      - **build-essential, g++, gcc**: Compiler tools and libraries.
      - **cmake, gfortran**: Build and Fortran compiler.
      - Various development libraries (libopenblas-dev, liblapack-dev, libfftw3-dev, etc.) for numerical computations, linear algebra, and scientific computing.
      - **libvtk7-dev**: Libraries for 3D computer graphics, visualization, and image processing.
      - **libgomp1, libomp-dev, libpthread-stubs0-dev**: Libraries for multi-threading support.

- **Purpose**: Updates the package list and installs a set of essential libraries and tools required for compiling and building various applications.
- **Packages Installed**:
    - **build-essential, g++, gcc**: Compiler tools and libraries.
    - **cmake, gfortran**: Build and Fortran compiler.
    - Various development libraries (libopenblas-dev, liblapack-dev, libfftw3-dev, etc.) for numerical computations, linear algebra, and scientific computing.
    - **libvtk7-dev**: Libraries for 3D computer graphics, visualization, and image processing.
    - **libgomp1, libomp-dev, libpthread-stubs0-dev**: Libraries for multi-threading support.

**Purpose**: Updates the package list and installs a set of essential libraries and tools required for compiling and building various applications.

: Updates the package list and installs a set of essential libraries and tools required for compiling and building various applications.

**Packages Installed**:
  - **build-essential, g++, gcc**: Compiler tools and libraries.
  - **cmake, gfortran**: Build and Fortran compiler.
  - Various development libraries (libopenblas-dev, liblapack-dev, libfftw3-dev, etc.) for numerical computations, linear algebra, and scientific computing.
  - **libvtk7-dev**: Libraries for 3D computer graphics, visualization, and image processing.
  - **libgomp1, libomp-dev, libpthread-stubs0-dev**: Libraries for multi-threading support.

- **build-essential, g++, gcc**: Compiler tools and libraries.
- **cmake, gfortran**: Build and Fortran compiler.
- Various development libraries (libopenblas-dev, liblapack-dev, libfftw3-dev, etc.) for numerical computations, linear algebra, and scientific computing.
- **libvtk7-dev**: Libraries for 3D computer graphics, visualization, and image processing.
- **libgomp1, libomp-dev, libpthread-stubs0-dev**: Libraries for multi-threading support.

Various development libraries (libopenblas-dev, liblapack-dev, libfftw3-dev, etc.) for numerical computations, linear algebra, and scientific computing.

**libvtk7-dev**: Libraries for 3D computer graphics, visualization, and image processing.

: Libraries for 3D computer graphics, visualization, and image processing.

**libgomp1, libomp-dev, libpthread-stubs0-dev**: Libraries for multi-threading support.

**Install Compilers**
  -**Purpose**: Ensures that g++ and gcc are installed. These are essential compilers for C++ and C programming languages, often needed for compiling native code.

-**Purpose**: Ensures that g++ and gcc are installed. These are essential compilers for C++ and C programming languages, often needed for compiling native code.

: Ensures that g++ and gcc are installed. These are essential compilers for C++ and C programming languages, often needed for compiling native code.

**Install Python and pip**
  -**Purpose**: Installs Python 3 and pip (Python package installer), which are essential for Python-based applications and managing Python dependencies.

-**Purpose**: Installs Python 3 and pip (Python package installer), which are essential for Python-based applications and managing Python dependencies.

: Installs Python 3 and pip (Python package installer), which are essential for Python-based applications and managing Python dependencies.

**Copy current directory to docker image**
  -**Purpose**:  Sets the working directory inside the Docker image to ``/dgtd`` and copies all files from the current directory (presumably where the Dockerfile resides) into the ``/dgtd`` directory inside the Docker image.

-**Purpose**:  Sets the working directory inside the Docker image to ``/dgtd`` and copies all files from the current directory (presumably where the Dockerfile resides) into the ``/dgtd`` directory inside the Docker image.

 and copies all files from the current directory (presumably where the Dockerfile resides) into the 

**Install Python dependencies**
  -**Purpose**:  Installs Python dependencies listed in ``requirements.txt`` file located in the /dgtd directory. The ``--no-cache-dir`` flag ensures that no cached packages are used during installation, which can be important for Docker images to maintain consistency and avoid unexpected behavior.

-**Purpose**:  Installs Python dependencies listed in ``requirements.txt`` file located in the /dgtd directory. The ``--no-cache-dir`` flag ensures that no cached packages are used during installation, which can be important for Docker images to maintain consistency and avoid unexpected behavior.

 flag ensures that no cached packages are used during installation, which can be important for Docker images to maintain consistency and avoid unexpected behavior.

**Set Path for libraries and CUDA**
  -**Purpose**: Sets environment variables related to CUDA (a parallel computing platform and programming model) if CUDA is used in the project. These variables define paths to CUDA libraries, binaries, headers, and compiler (``nvcc``).

-**Purpose**: Sets environment variables related to CUDA (a parallel computing platform and programming model) if CUDA is used in the project. These variables define paths to CUDA libraries, binaries, headers, and compiler (``nvcc``).

: Sets environment variables related to CUDA (a parallel computing platform and programming model) if CUDA is used in the project. These variables define paths to CUDA libraries, binaries, headers, and compiler (

# Step 3 : Installing required packages and setting up environment variables

# Update system and install libraries
RUN apt-get update && apt-get install -y \
        build-essential \
        cmake \
        gfortran \
        libopenblas-dev \
        liblapack-dev \
        libfftw3-dev \
        libmetis-dev \
        libvtk7-dev \
        libgomp1 \
        libomp-dev \
        libblas-dev \
        libpthread-stubs0-dev \
        && rm -rf /var/lib/apt/lists/*

# Install Compilers
RUN apt-get update && apt-get install -y g++ gcc

# Install Python and pip
RUN apt-get install -y python3 python3-pip

# Copy current directory to docker image
WORKDIR dgtd
COPY . .

# Install Python dependencies
RUN pip install --no-cache-dir -v -r /dgtd/requirements.txt

# Set Path for libraries and CUDA
ENV CUDA_HOME /usr/local/cuda
ENV LD_LIBRARY_PATH ${CUDA_HOME}/lib64
ENV PATH ${CUDA_HOME}/:bin:${PATH}
ENV CPATH ${CUDA_HOME}/include:${CPATH}
ENV CUDACXX ${CUDA_HOME}/bin/nvcc

Finally, we can compile a program using cmake and make, and then sets up the Docker container to start a Bash shell upon running. ``CMD ["bash"]`` sets the default command to run inside the container. When the container is started without specifying a command, it will automatically launch a Bash shell.

Finally, we can compile a program using cmake and make, and then sets up the Docker container to start a Bash shell upon running. 

 sets the default command to run inside the container. When the container is started without specifying a command, it will automatically launch a Bash shell.

# Step 4 : Compiling Program
RUN ls -l && mkdir build && cd build && cmake .. && make -j 4
CMD ["bash"]

Use the ``docker build`` command to build the Docker image from your Dockerfile.

Once you have created your Dockerfile and saved it in your project directory, you can build a Docker image using the docker build command. Here's how you would do it:

Once you have created your Dockerfile and saved it in your project directory, you can build a Docker image using the docker build command. Here’s how you would do it:

``docker build``: This command tells Docker to build an image from a Dockerfile.

: This command tells Docker to build an image from a Dockerfile.

``-t maxwell_td_image``: The -t flag is used to tag the image with a name (maxwell_td_image in this case). This name can be whatever you choose and is used to refer to this specific image later on.

: The -t flag is used to tag the image with a name (maxwell_td_image in this case). This name can be whatever you choose and is used to refer to this specific image later on.

``.``: This specifies the build context. The dot indicates that the Dockerfile and any other files needed for building the image are located in the current directory.

: This specifies the build context. The dot indicates that the Dockerfile and any other files needed for building the image are located in the current directory.

..  figure:: images/P7.png

    Run docker build to build Docker image

To verify if a Docker image has been successfully built on your local system, you can use the docker images command. Here’s how you can do it:

Open your terminal (Command Prompt on Windows or Terminal on macOS/Linux).

This command will list all Docker images that are currently present on your local system.
Each image listed will have columns showing its repository, tag, image ID, creation date, and size.

Look through the list for the image you just built. If it was successfully built, it should appear in the list.
Check the repository and tag names to identify your specific image. The repository name will likely be the name you assigned to it in your Dockerfile, and the tag will be latest or another tag you specified.

If your image appears in the list with the correct details (repository name, tag, etc.), it indicates that Docker successfully built and stored the image on your local machine.

..  figure:: images/P8.png

    Check Docker image

To save a Docker image locally as a tar archive, you'll use the docker save command. This command packages the Docker image into a tarball archive that can be transferred to other machines or stored for backup purposes. Here’s how you can do it:

To save a Docker image locally as a tar archive, you’ll use the docker save command. This command packages the Docker image into a tarball archive that can be transferred to other machines or stored for backup purposes. Here’s how you can do it:

Replace ``<output-file-name>.zip`` with the desired name for your zip archive file.

After running the command, Docker will package the specified image into zip named <output-file-name>.zip.
You should see the zipfile ( <output-file-name>.zip) in your current directory unless you specified a different path for the output.

..  figure:: images/P9.png

    Save Docker image

..  figure:: images/P10.png

    Resulting zipped Docker image

- Transportability: The generated zip can be transferred to another machine or stored for future use. This is useful for deploying Docker images across different environments without needing to rebuild them.

- File Size: Depending on the size of your Docker image, the resulting zip archive can be quite large. Ensure you have enough disk space and consider compression techniques if transferring over networks with limited bandwidth.

- Loading the Image: To use the saved zip file on another machine, you'll need to load it into Docker using the docker load command. Here’s how you can do that:

.. code-block:: bash

    docker load -i <path/to/your/image.tar>

Replace <path/to/your/image.tar> with the actual path to your saved tar archive file.

Transportability: The generated zip can be transferred to another machine or stored for future use. This is useful for deploying Docker images across different environments without needing to rebuild them.

File Size: Depending on the size of your Docker image, the resulting zip archive can be quite large. Ensure you have enough disk space and consider compression techniques if transferring over networks with limited bandwidth.

Loading the Image: To use the saved zip file on another machine, you'll need to load it into Docker using the docker load command. Here’s how you can do that:

Loading the Image: To use the saved zip file on another machine, you’ll need to load it into Docker using the docker load command. Here’s how you can do that:

To clean up any dangling resources (images, containers, volumes, networks), use the following command:

To remove stopped containers and all unused images (not just dangling), add the `-a` flag:

To remove stopped containers and all unused images (not just dangling), add the 

To remove specific images, list them using ``docker images -a`` and then delete them with ``docker rmi``:

docker images -a             # List all images
docker rmi Image Image       # Remove specific images by ID or tag

To remove specific containers, list them using ``docker ps -a`` and then delete them with ``docker rm``:

docker ps -a                 # List all containers
docker rm ID_or_Name ID_or_Name  # Remove specific containers by ID or name

To remove specific volumes, list them using `docker volume ls` and then delete them with `docker volume rm`:

docker volume ls             # List all volumes
docker volume rm volume_name volume_name  # Remove specific volumes by name

Docker Desktop is a powerful tool that simplifies the development, deployment, and management of applications using containers. Here's an introduction to Docker Desktop:

Docker Desktop is a powerful tool that simplifies the development, deployment, and management of applications using containers. Here’s an introduction to Docker Desktop:

Docker Desktop is an application for both Mac and Windows operating systems that enables developers to create, deploy, and manage applications using Docker containers. It provides an easy-to-use interface for working with Docker containers, images, volumes, and networks.

**Containerization**: Docker Desktop utilizes containerization technology to package applications and their dependencies into lightweight, portable containers. This allows developers to isolate applications from their environment and ensures consistent behavior across different computing environments.

: Docker Desktop utilizes containerization technology to package applications and their dependencies into lightweight, portable containers. This allows developers to isolate applications from their environment and ensures consistent behavior across different computing environments.

**Graphical User Interface (GUI)**: Docker Desktop comes with a user-friendly GUI that allows developers to perform container-related tasks such as creating, managing, and monitoring containers using a visual interface. This makes it easy for developers to interact with Docker without needing to use the command line.

: Docker Desktop comes with a user-friendly GUI that allows developers to perform container-related tasks such as creating, managing, and monitoring containers using a visual interface. This makes it easy for developers to interact with Docker without needing to use the command line.

**Integrated Development Environment (IDE) Integration**: Docker Desktop seamlessly integrates with popular IDEs such as Visual Studio Code, allowing developers to build, debug, and test containerized applications directly from their development environment.

: Docker Desktop seamlessly integrates with popular IDEs such as Visual Studio Code, allowing developers to build, debug, and test containerized applications directly from their development environment.

**Multi-Platform Support**: Docker Desktop supports both Mac and Windows operating systems, allowing developers to build and run containerized applications on their preferred platform without needing to worry about compatibility issues.

: Docker Desktop supports both Mac and Windows operating systems, allowing developers to build and run containerized applications on their preferred platform without needing to worry about compatibility issues.

**Local Development Environment**: Docker Desktop provides a local development environment that closely mirrors production environments, allowing developers to build and test applications in an environment that closely resembles where they will eventually be deployed.

: Docker Desktop provides a local development environment that closely mirrors production environments, allowing developers to build and test applications in an environment that closely resembles where they will eventually be deployed.

**Automatic Updates**: Docker Desktop regularly receives updates and new features, ensuring that developers have access to the latest Docker capabilities and improvements.

: Docker Desktop regularly receives updates and new features, ensuring that developers have access to the latest Docker capabilities and improvements.

Docker Desktop is a comprehensive package offered by Docker, providing both a graphical user interface (GUI) and a command-line interface (CLI). It serves as a unified platform for developers to manage their Docker containers and workflows seamlessly. One of its key features is its inclusion of a Linux virtual machine, which acts as the runtime environment for Docker containers on non-Linux systems such as Windows and macOS.

For Windows, it is reuqired that the user install Windows Subsystem for Linux (WSL) seperately from the installation of Docker Desktop.

This virtual machine wraps around Docker's core components, including the CLI and the Docker API at the server side, facilitating the creation, management, and deployment of containers. Additionally, Docker Desktop includes the Docker Daemon, which is responsible for managing container lifecycle and interacting with the operating system's kernel.

This virtual machine wraps around Docker’s core components, including the CLI and the Docker API at the server side, facilitating the creation, management, and deployment of containers. Additionally, Docker Desktop includes the Docker Daemon, which is responsible for managing container lifecycle and interacting with the operating system’s kernel.

While in a Linux environment, working directly with the Docker Engine, a lighter version of Docker, is often sufficient. However, for Windows users, especially those on Windows 11, Docker Desktop is recommended. This recommendation is primarily due to compatibility reasons, especially for users requiring NVIDIA GPU support for containerized applications.

In summary, Docker Desktop provides a unified solution for Docker container management, combining a user-friendly interface with essential tools and runtime environments to streamline the development and deployment of containerized applications across different operating systems.

**Execution Instance**: A container is a runtime instance of an image. It's a lightweight, standalone, and executable package that encapsulates all the dependencies required to run a piece of software.

: A container is a runtime instance of an image. It’s a lightweight, standalone, and executable package that encapsulates all the dependencies required to run a piece of software.

**Isolation**: Containers provide process isolation, ensuring that applications running within them are isolated from one another and from the host system.

: Containers provide process isolation, ensuring that applications running within them are isolated from one another and from the host system.

**Dynamic**: Containers can be started, stopped, moved, and deleted dynamically. They are ephemeral by nature, meaning they can be created, destroyed, and replaced rapidly.

: Containers can be started, stopped, moved, and deleted dynamically. They are ephemeral by nature, meaning they can be created, destroyed, and replaced rapidly.

**Runtime Environment**: Each container runs in its own isolated environment, including its own filesystem, networking, and process space.

: Each container runs in its own isolated environment, including its own filesystem, networking, and process space.

**Blueprint**: An image is a static, immutable blueprint used to create containers. It's a snapshot of a container that includes the application code, runtime, libraries, dependencies, and other configuration needed to run the software.

: An image is a static, immutable blueprint used to create containers. It’s a snapshot of a container that includes the application code, runtime, libraries, dependencies, and other configuration needed to run the software.

**Build Artifact**: Images are created either manually or through automated build processes. They are stored in a registry and serve as the foundation for creating containers.

: Images are created either manually or through automated build processes. They are stored in a registry and serve as the foundation for creating containers.

**Reusable**: Images can be shared, reused, and distributed across different environments and systems. They provide a consistent environment for running applications regardless of the underlying infrastructure.

: Images can be shared, reused, and distributed across different environments and systems. They provide a consistent environment for running applications regardless of the underlying infrastructure.

**Layered Structure**: Docker images are composed of multiple layers, with each layer representing a filesystem change. This layered structure enables efficient storage, distribution, and reuse of images.

: Docker images are composed of multiple layers, with each layer representing a filesystem change. This layered structure enables efficient storage, distribution, and reuse of images.

**Statefulness**: Containers are dynamic and stateful, while images are static and stateless. Containers can be modified and retain changes during runtime, whereas images remain immutable.

: Containers are dynamic and stateful, while images are static and stateless. Containers can be modified and retain changes during runtime, whereas images remain immutable.

**Lifecycle**: Containers have a lifecycle—they can be created, started, stopped, paused, and deleted. Images, on the other hand, do not have a lifecycle; they are static artifacts used to create containers.

: Containers have a lifecycle—they can be created, started, stopped, paused, and deleted. Images, on the other hand, do not have a lifecycle; they are static artifacts used to create containers.

**Composition**: Images serve as the building blocks for containers. Multiple containers can be instantiated from the same image, each running independently with its own isolated environment.

: Images serve as the building blocks for containers. Multiple containers can be instantiated from the same image, each running independently with its own isolated environment.

**Persistence**: Containers are ephemeral, meaning any changes made inside a container only persist as long as the container is running. Images, being immutable, preserve the state of the filesystem at the time of creation.

: Containers are ephemeral, meaning any changes made inside a container only persist as long as the container is running. Images, being immutable, preserve the state of the filesystem at the time of creation.

In essence, containers are the runtime instances of images, while images are the blueprints used to create containers. They work together to enable the efficient deployment, management, and execution of applications in a containerized environment.

Generally, enabling virtualization from the BIOS and installing Windows Subsystem for Linux (WSL) are crucial steps for setting up Docker Desktop on Windows machines. Here's an updated summary of the general steps for Windows installation, including these prerequisites and the links you provided:

Generally, enabling virtualization from the BIOS and installing Windows Subsystem for Linux (WSL) are crucial steps for setting up Docker Desktop on Windows machines. Here’s an updated summary of the general steps for Windows installation, including these prerequisites and the links you provided:

**Enable Virtualization from BIOS**: Before installing Docker Desktop, ensure that virtualization is enabled in your system's BIOS settings. This step is crucial for Docker Desktop to function properly on Windows machines. Refer to this link for instructions on how to enable virtualization: [Hardware-Assisted Virtualization and Data Execution Protection](https://forums.docker.com/t/hardware-assisted-virtualization-and-data-execution-protection-must-be-enabled-in-the-bios/109073).

: Before installing Docker Desktop, ensure that virtualization is enabled in your system’s BIOS settings. This step is crucial for Docker Desktop to function properly on Windows machines. Refer to this link for instructions on how to enable virtualization: [Hardware-Assisted Virtualization and Data Execution Protection](

**Install Windows Subsystem for Linux (WSL)**: Docker Desktop relies on WSL to run Linux containers on Windows. Install WSL by following the instructions provided in this link: [Install Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/install).

: Docker Desktop relies on WSL to run Linux containers on Windows. Install WSL by following the instructions provided in this link: [Install Windows Subsystem for Linux (WSL)](

**Download Docker Desktop Installer**: Visit the official Docker website and navigate to the Windows installation page. From there, download the Docker Desktop installer executable.

: Visit the official Docker website and navigate to the Windows installation page. From there, download the Docker Desktop installer executable.

**Run the Installer**: After downloading the installer, double-click on it to launch the installation wizard.

: After downloading the installer, double-click on it to launch the installation wizard.

**Follow Installation Instructions**: Follow the on-screen instructions provided by the installation wizard. This includes accepting the license agreement, choosing installation options, and specifying the installation location.

: Follow the on-screen instructions provided by the installation wizard. This includes accepting the license agreement, choosing installation options, and specifying the installation location.

**System Requirements Check**: During the installation process, Docker Desktop may perform a system requirements check to ensure your system meets the necessary prerequisites for installation.

: During the installation process, Docker Desktop may perform a system requirements check to ensure your system meets the necessary prerequisites for installation.

**Enable Hyper-V (if required)**: Docker Desktop for Windows may require Hyper-V to be enabled. (It can also work with WSL) If it's not already enabled, the installer will prompt you to enable it. This step might require a system reboot.

: Docker Desktop for Windows may require Hyper-V to be enabled. (It can also work with WSL) If it’s not already enabled, the installer will prompt you to enable it. This step might require a system reboot.

**Configuration**: Once the installation is complete, Docker Desktop may require additional configuration, such as configuring shared drives or network settings.

: Once the installation is complete, Docker Desktop may require additional configuration, such as configuring shared drives or network settings.

**Launch Docker Desktop**: After successful installation and configuration, Docker Desktop can be launched from the Start menu or desktop shortcut.

: After successful installation and configuration, Docker Desktop can be launched from the Start menu or desktop shortcut.

**Sign in (if required)**: Depending on your Docker configuration, you may need to sign in to your Docker account during the initial setup. Sign-in is usually optional.

: Depending on your Docker configuration, you may need to sign in to your Docker account during the initial setup. Sign-in is usually optional.

**Verify Installation**: To ensure Docker Desktop is installed correctly, you can open a command prompt or PowerShell window and run `docker --version` to verify the Docker CLI version.

: To ensure Docker Desktop is installed correctly, you can open a command prompt or PowerShell window and run 

**Start Using Docker**: With Docker Desktop installed and running, you're ready to start building, running, and managing containers on your Windows system. To use Docker CLI, users will have to start Docker Desktop.

: With Docker Desktop installed and running, you’re ready to start building, running, and managing containers on your Windows system. To use Docker CLI, users will have to start Docker Desktop.

By following these steps, including enabling virtualization from the BIOS and installing WSL, you can successfully install Docker Desktop on your Windows machine and leverage the benefits of containerization for your development projects.

Accessing the BIOS (Basic Input/Output System) varies slightly depending on your computer's manufacturer and model. Here's a general guide on how to access the BIOS on most Windows computers:

Accessing the BIOS (Basic Input/Output System) varies slightly depending on your computer’s manufacturer and model. Here’s a general guide on how to access the BIOS on most Windows computers:

**Shut Down Your Computer**: Ensure that your computer is fully powered off, not just in sleep or hibernate mode.

: Ensure that your computer is fully powered off, not just in sleep or hibernate mode.

**Start Your Computer**: Press the power button to turn on your computer.

**Start Tapping the BIOS Key**: Immediately after pressing the power button, start tapping the appropriate key to enter the BIOS. The BIOS key varies depending on your computer's manufacturer. Common keys include:
- **F2**
- **F10**
- **F12**
- **Esc**
- **Delete**
- **Enter**

- **F2**
- **F10**
- **F12**
- **Esc**

: Immediately after pressing the power button, start tapping the appropriate key to enter the BIOS. The BIOS key varies depending on your computer’s manufacturer. Common keys include:
- 

**Check for BIOS Key**: If you're unsure which key to press, check your computer's manual or the manufacturer's website. Sometimes, the BIOS key is displayed briefly on the screen during startup.

: If you’re unsure which key to press, check your computer’s manual or the manufacturer’s website. Sometimes, the BIOS key is displayed briefly on the screen during startup.

**Enter BIOS Setup**: Continuously tapping the BIOS key should bring you to the BIOS setup screen. This screen typically has a blue or black background with various options and settings.

: Continuously tapping the BIOS key should bring you to the BIOS setup screen. This screen typically has a blue or black background with various options and settings.

**Navigate BIOS Menu**: Once inside the BIOS setup, you can navigate using the arrow keys on your keyboard. Be cautious when making changes in the BIOS, as incorrect settings can affect the stability and performance of your computer.

: Once inside the BIOS setup, you can navigate using the arrow keys on your keyboard. Be cautious when making changes in the BIOS, as incorrect settings can affect the stability and performance of your computer.

**Enable Virtualization**: Look for settings related to virtualization (e.g., Intel Virtualization Technology, AMD-V) in the BIOS setup. Depending on your BIOS version and layout, virtualization settings may be located under different menus such as "Advanced," "Security," or "CPU Configuration." Enable virtualization if it's disabled.

: Look for settings related to virtualization (e.g., Intel Virtualization Technology, AMD-V) in the BIOS setup. Depending on your BIOS version and layout, virtualization settings may be located under different menus such as “Advanced,” “Security,” or “CPU Configuration.” Enable virtualization if it’s disabled.

**Save and Exit**: After making changes, save your settings and exit the BIOS setup. This process is usually done by pressing the appropriate key (often labeled as "Save & Exit" or similar) and confirming your choice.

: After making changes, save your settings and exit the BIOS setup. This process is usually done by pressing the appropriate key (often labeled as “Save & Exit” or similar) and confirming your choice.

**Restart Your Computer**: Once you've exited the BIOS setup, your computer will restart.

: Once you’ve exited the BIOS setup, your computer will restart.

**Verify Virtualization**: After restarting, you can verify if virtualization is enabled by checking your computer's system information or BIOS settings.

: After restarting, you can verify if virtualization is enabled by checking your computer’s system information or BIOS settings.

Remember, accessing the BIOS can vary depending on your computer's manufacturer and model, so if you're unsure, refer to your computer's manual or the manufacturer's website for specific instructions.

Remember, accessing the BIOS can vary depending on your computer’s manufacturer and model, so if you’re unsure, refer to your computer’s manual or the manufacturer’s website for specific instructions.

To install Windows Subsystem for Linux (WSL) and manage its settings, follow these steps:

**Install WSL**: Open PowerShell or Windows Command Prompt as an administrator and run the command ''wsl --install''. This command enables the necessary features to run WSL and installs the default Ubuntu distribution of Linux. After running the command, restart your machine.

: Open PowerShell or Windows Command Prompt as an administrator and run the command ‘’wsl –install’’. This command enables the necessary features to run WSL and installs the default Ubuntu distribution of Linux. After running the command, restart your machine.

**Check WSL Version**: To check which version of WSL you are running and view your installed Linux distributions, use the command ''wsl -l -v'' in PowerShell or Command Prompt.

: To check which version of WSL you are running and view your installed Linux distributions, use the command ‘’wsl -l -v’’ in PowerShell or Command Prompt.

**Set Default WSL Version**: If you want to set the default version to WSL 1 or WSL 2, use the command ''wsl --set-default-version <Version#>'', replacing `<Version#>` with either 1 or 2.

: If you want to set the default version to WSL 1 or WSL 2, use the command ‘’wsl –set-default-version <Version#>’’, replacing 

**Set Default Linux Distribution**: To set the default Linux distribution used with the ''wsl'' command, enter ''wsl -s <DistributionName>'' or ''wsl --set-default <DistributionName>'', replacing ''<DistributionName>'' with the name of the Linux distribution you want to use.

: To set the default Linux distribution used with the ‘’wsl’’ command, enter ‘’wsl -s <DistributionName>’’ or ‘’wsl –set-default <DistributionName>’’, replacing ‘’<DistributionName>’’ with the name of the Linux distribution you want to use.

Following these steps allows you to easily install and manage Windows Subsystem for Linux (WSL) on your Windows machine, enabling you to run Linux commands and utilities alongside your Windows environment.

In general, Docker Engine can be installed on Ubuntu Linux using the instructions provided in the official Docker documentation at https://docs.docker.com/engine/install/ubuntu/. This documentation outlines the steps necessary to install Docker Engine on an Ubuntu system, ensuring that you have the latest version of Docker available for your use.

In general, Docker Engine can be installed on Ubuntu Linux using the instructions provided in the official Docker documentation at 

. This documentation outlines the steps necessary to install Docker Engine on an Ubuntu system, ensuring that you have the latest version of Docker available for your use.

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Verify that the Docker Engine installation is successful by running the hello-world image.

Docker Desktop is available for installation on the following operating systems:

**Windows 10/11**: Docker Desktop is compatible with Windows 10 and Windows 11 operating systems. It leverages the native Hyper-V virtualization technology on Windows to run containers.

: Docker Desktop is compatible with Windows 10 and Windows 11 operating systems. It leverages the native Hyper-V virtualization technology on Windows to run containers.

To ensure NVIDIA GPU compatibility, please use the latest updated Windows 10 or Windows 11. When we tested it with Windows 10 on our machine (not with the latest patches), the code ran into memory errors. However, after updating to Windows 11, the software ran without issues.

More information can be found in the following links:

- `NVIDIA Container Toolkit Issue #226 <https://github.com/NVIDIA/nvidia-container-toolkit/issues/226>`__
- `NVIDIA Developer Forum Thread <https://forums.developer.nvidia.com/t/pinned-memory-size-problem/13740>`__

`NVIDIA Container Toolkit Issue #226 <https://github.com/NVIDIA/nvidia-container-toolkit/issues/226>`__

`NVIDIA Developer Forum Thread <https://forums.developer.nvidia.com/t/pinned-memory-size-problem/13740>`__

**Mac**: Docker Desktop is compatible with macOS, allowing Mac users to build and manage containers seamlessly using the Docker Desktop application.

: Docker Desktop is compatible with macOS, allowing Mac users to build and manage containers seamlessly using the Docker Desktop application.

**Linux (Ubuntu Distro 22 and above)**: Docker Desktop is supported on Linux systems running Ubuntu distributions version 22 and above. It provides a convenient way for Linux users to utilize Docker containers within their development workflow.

: Docker Desktop is supported on Linux systems running Ubuntu distributions version 22 and above. It provides a convenient way for Linux users to utilize Docker containers within their development workflow.

For Linux Ubuntu Distro 20, we can only install Docker Engine, which is sufficient for most cases.

Docker is a platform for developing, shipping, and running applications. It uses containerization technology to package software and its dependencies into standardized units called containers. These containers are lightweight, portable, and isolated, allowing applications to run consistently across different environments, from development to production.

With Docker, developers can build, ship, and deploy applications faster and more efficiently by eliminating compatibility issues between different systems. Docker simplifies the process of managing and scaling applications, making it easier to deploy and update software in any environment, whether it's on-premises, in the cloud, or hybrid.

With Docker, developers can build, ship, and deploy applications faster and more efficiently by eliminating compatibility issues between different systems. Docker simplifies the process of managing and scaling applications, making it easier to deploy and update software in any environment, whether it’s on-premises, in the cloud, or hybrid.

Overall, Docker revolutionizes the way applications are developed, deployed, and managed, enabling teams to innovate more rapidly and reliably.

To see why containers are useful, let us look at the following 2 scenarios.

To set up the development environment, install these libraries and run these scripts

To run the software, prepare Ubuntu of version 22.02. Install these dependencies and run the software

In modern computing, various technologies cater to different needs and scenarios. Bare metal, virtual machines, and containers represent three fundamental approaches to deploying and managing applications, each with its own set of advantages and use cases.

Bare metal refers to the traditional method of running applications directly on physical servers without any virtualization layer. In this setup, the operating system interacts directly with the underlying hardware. Bare metal environments offer maximum performance and control since all resources are dedicated to the application. They are ideal for high-performance workloads where every bit of computational power counts.

Virtual machines emulate physical hardware within a host server, allowing multiple operating systems and applications to run independently on the same physical hardware. Each VM runs its own guest operating system, providing strong isolation from other VMs. VMs offer flexibility, enabling different operating systems and configurations to coexist on the same hardware. They are commonly used for server consolidation, testing, and development environments.

When using VM, a hypervisor is usually needed. It is a software or firmware layer that enables the creation and management of virtual machines (VMs) on physical hardware. It sits between the hardware and the operating systems (OS) running on the VMs, facilitating the sharing of physical resources among multiple virtual environments.

Type 1 hypervisors run directly on the physical hardware without the need for a host operating system. They are often referred to as "bare metal" hypervisors because they have direct access to the underlying hardware.
Examples include AWS Nitro System, VMware vSphere, and Microsoft Hyper-V.
Type 1 hypervisors provide efficient and high-performance virtualization, making them suitable for enterprise-level deployments and cloud computing environments.

Type 1 hypervisors run directly on the physical hardware without the need for a host operating system. They are often referred to as “bare metal” hypervisors because they have direct access to the underlying hardware.

Type 2 hypervisors run on top of a host operating system, which means they rely on the underlying OS for hardware access.
These hypervisors are commonly used on desktop or workstation environments for development, testing, and running multiple operating systems simultaneously.
Examples include Oracle VirtualBox, VMware Workstation, and Parallels Desktop.
While Type 2 hypervisors offer ease of use and flexibility, they may introduce some performance overhead due to the additional layer of the host OS.

Containers are lightweight, portable, and isolated environments for running applications and their dependencies. Unlike VMs, containers share the host operating system's kernel, which reduces overhead and improves efficiency. Containers provide fast deployment times and scalability, making them ideal for microservices architectures, continuous integration and deployment (CI/CD) pipelines, and DevOps practices.

Containers are lightweight, portable, and isolated environments for running applications and their dependencies. Unlike VMs, containers share the host operating system’s kernel, which reduces overhead and improves efficiency. Containers provide fast deployment times and scalability, making them ideal for microservices architectures, continuous integration and deployment (CI/CD) pipelines, and DevOps practices.

f-strings support = for self-documenting expressions and debugging

ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON 3.12.4 DOCUMENTATION

email.message.Message: Representing an email message using the compat32 API

What is the most efficient way to concatenate many strings together?

Why does a_tuple[i] += [‘item’] raise an exception when the addition works?

What does the slash(/) in the parameter list of a function mean?

Why am I getting an UnboundLocalError when the variable has a value?

PEP 3118: New memoryview implementation and buffer protocol documentation

PEP 476: Enabling certificate verification by default for stdlib http clients

PEP 471 - os.scandir() function – a better and faster directory iterator

PEP 655: Marking individual TypedDict items as required or not-required

Why must ‘self’ be used explicitly in method definitions and calls?

argparse — Parser for command-line options, arguments and sub-commands

functools — Higher-order functions and operations on callable objects

importlib.resources – Package resource reading, opening and access

multiprocessing.shared_memory — Shared memory for direct access across processes

sysconfig — Provide access to Python’s configuration information

Extension internationalization (i18n) and localization (l10n) using i18n API

sphinx.ext.imgconverter – A reference image converter using Imagemagick

sphinx.ext.autosectionlabel – Allow reference sections using its title

sphinx.ext.napoleon – Support for NumPy and Google style docstrings