|
|
<!DOCTYPE html>
|
|
|
<html class="writer-html5" lang="en" data-content_root="./">
|
|
|
<head>
|
|
|
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
<title>Docker Engine — Documentation for Docker Installation and Usage 1.0 documentation</title>
|
|
|
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
|
|
|
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
|
|
|
<link rel="stylesheet" type="text/css" href="_static/graphviz.css?v=fd3f3429" />
|
|
|
|
|
|
|
|
|
<!--[if lt IE 9]>
|
|
|
<script src="_static/js/html5shiv.min.js"></script>
|
|
|
<![endif]-->
|
|
|
|
|
|
<script src="_static/jquery.js?v=5d32c60e"></script>
|
|
|
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
|
|
|
<script src="_static/documentation_options.js?v=f2a433a1"></script>
|
|
|
<script src="_static/doctools.js?v=9a2dae69"></script>
|
|
|
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
|
<script src="_static/js/mathjax-config.js?v=4e65e8ea"></script>
|
|
|
<script src="_static/js/theme.js"></script>
|
|
|
<link rel="index" title="Index" href="genindex.html" />
|
|
|
<link rel="search" title="Search" href="search.html" />
|
|
|
<link rel="next" title="User Manual (Windows System)" href="Manual.html" />
|
|
|
<link rel="prev" title="Docker Desktop" href="desktop.html" />
|
|
|
</head>
|
|
|
|
|
|
<body class="wy-body-for-nav">
|
|
|
<div class="wy-grid-for-nav">
|
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
|
<div class="wy-side-scroll">
|
|
|
<div class="wy-side-nav-search" >
|
|
|
|
|
|
|
|
|
|
|
|
<a href="index.html" class="icon icon-home">
|
|
|
Documentation for Docker Installation and Usage
|
|
|
</a>
|
|
|
<div class="version">
|
|
|
1.0.0
|
|
|
</div>
|
|
|
<div role="search">
|
|
|
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
|
|
|
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
|
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
|
<input type="hidden" name="area" value="default" />
|
|
|
</form>
|
|
|
</div>
|
|
|
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
|
|
<ul class="current">
|
|
|
<li class="toctree-l1"><a class="reference internal" href="desktop.html">Docker Desktop</a><ul>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="desktop.html#what-is-docker-desktop">What is Docker Desktop?</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="desktop.html#key-features">Key Features</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="desktop.html#docker-desktop-architecture">Docker Desktop Architecture</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="desktop.html#difference-between-images-and-containers">Difference between images and containers</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="desktop.html#installation-in-windows">Installation in Windows</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="desktop.html#enable-virtualization-for-windows-machine">Enable Virtualization for Windows Machine</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="desktop.html#installing-wsl">Installing WSL</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="desktop.html#installation-in-linux">Installation in Linux</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="desktop.html#supported-operating-systems">Supported Operating Systems</a></li>
|
|
|
</ul>
|
|
|
</li>
|
|
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Docker Engine</a><ul>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#what-is-docker-engine">What is Docker Engine?</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#basic-functionalities-of-docker-engine">Basic Functionalities of Docker Engine</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#key-benefits-of-docker-engine">Key Benefits of Docker Engine</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#basic-steps-to-build-docker-images">Basic Steps to build Docker images</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#how-to-check-images">How to check images</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#how-to-save-built-image-locally">How to save built image locally</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#managing-docker-resources">Managing Docker Resources</a></li>
|
|
|
</ul>
|
|
|
</li>
|
|
|
<li class="toctree-l1"><a class="reference internal" href="Manual.html">User Manual (Windows System)</a><ul>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="Manual.html#step-by-step-installation-in-windows">Step-by-Step installation in Windows</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="Manual.html#activate-virtualization-in-bios">Activate Virtualization in BIOS</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="Manual.html#install-wsl">Install WSL</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="Manual.html#install-docker-desktop-in-windows">Install Docker Desktop in Windows</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="Manual.html#import-docker-image">Import Docker Image</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="Manual.html#mounting-user-data-and-running-docker-image">Mounting User data and running Docker image</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="Manual.html#how-to-use-maxwell-td">How to use Maxwell-TD</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="Manual.html#common-issues">Common issues</a><ul>
|
|
|
<li class="toctree-l3"><a class="reference internal" href="Manual.html#incompatible-gpu-drivers-toolkit">Incompatible GPU drivers/toolkit</a></li>
|
|
|
<li class="toctree-l3"><a class="reference internal" href="Manual.html#windows-version">Windows Version</a></li>
|
|
|
<li class="toctree-l3"><a class="reference internal" href="Manual.html#sufficient-memory-to-upload-image">Sufficient Memory to upload image</a></li>
|
|
|
<li class="toctree-l3"><a class="reference internal" href="Manual.html#bios-settings">BIOS settings</a></li>
|
|
|
<li class="toctree-l3"><a class="reference internal" href="Manual.html#change-simulation-parameters">Change Simulation Parameters</a></li>
|
|
|
</ul>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</li>
|
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
</nav>
|
|
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
|
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
|
<a href="index.html">Documentation for Docker Installation and Usage</a>
|
|
|
</nav>
|
|
|
|
|
|
<div class="wy-nav-content">
|
|
|
<div class="rst-content">
|
|
|
<div role="navigation" aria-label="Page navigation">
|
|
|
<ul class="wy-breadcrumbs">
|
|
|
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
|
|
|
<li class="breadcrumb-item active">Docker Engine</li>
|
|
|
<li class="wy-breadcrumbs-aside">
|
|
|
<a href="_sources/build.rst.txt" rel="nofollow"> View page source</a>
|
|
|
</li>
|
|
|
</ul>
|
|
|
<hr/>
|
|
|
</div>
|
|
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
|
<div itemprop="articleBody">
|
|
|
|
|
|
<section id="docker-engine">
|
|
|
<h1>Docker Engine<a class="headerlink" href="#docker-engine" title="Link to this heading"></a></h1>
|
|
|
<p>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:</p>
|
|
|
<section id="what-is-docker-engine">
|
|
|
<h2>What is Docker Engine?<a class="headerlink" href="#what-is-docker-engine" title="Link to this heading"></a></h2>
|
|
|
<p>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.</p>
|
|
|
</section>
|
|
|
<section id="basic-functionalities-of-docker-engine">
|
|
|
<h2>Basic Functionalities of Docker Engine<a class="headerlink" href="#basic-functionalities-of-docker-engine" title="Link to this heading"></a></h2>
|
|
|
<ol class="arabic simple">
|
|
|
<li><p><strong>Containerization:</strong> 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.</p></li>
|
|
|
<li><p><strong>Image Management:</strong> 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.</p></li>
|
|
|
<li><p><strong>Container Lifecycle Management:</strong> 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.</p></li>
|
|
|
<li><p><strong>Networking:</strong> 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.</p></li>
|
|
|
<li><p><strong>Storage Management:</strong> 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.</p></li>
|
|
|
<li><p><strong>Resource Isolation and Utilization:</strong> 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.</p></li>
|
|
|
<li><p><strong>Integration with Orchestration Tools:</strong> 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.</p></li>
|
|
|
</ol>
|
|
|
</section>
|
|
|
<section id="key-benefits-of-docker-engine">
|
|
|
<h2>Key Benefits of Docker Engine<a class="headerlink" href="#key-benefits-of-docker-engine" title="Link to this heading"></a></h2>
|
|
|
<ul class="simple">
|
|
|
<li><p><strong>Consistency:</strong> Docker ensures consistency between development, testing, and production environments by encapsulating applications and dependencies into containers.</p></li>
|
|
|
<li><p><strong>Efficiency:</strong> Containers are lightweight and share the host system’s kernel, reducing overhead and improving performance compared to traditional virtual machines.</p></li>
|
|
|
<li><p><strong>Portability:</strong> Docker containers can run on any platform that supports Docker, making it easy to move applications between different environments.</p></li>
|
|
|
<li><p><strong>Isolation:</strong> Containers provide a level of isolation that enhances security and stability, as each container operates independently of others on the same host.</p></li>
|
|
|
</ul>
|
|
|
</section>
|
|
|
<section id="basic-steps-to-build-docker-images">
|
|
|
<h2>Basic Steps to build Docker images<a class="headerlink" href="#basic-steps-to-build-docker-images" title="Link to this heading"></a></h2>
|
|
|
<ol class="arabic simple">
|
|
|
<li><p>Create a <strong>Dockerfile</strong> that provides instructions to build Docker image.</p></li>
|
|
|
</ol>
|
|
|
<figure class="align-center" id="id1">
|
|
|
<a class="reference internal image-reference" href="_images/P4.png"><img alt="_images/P4.png" src="_images/P4.png" style="width: 1200px;" /></a>
|
|
|
<figcaption>
|
|
|
<p><span class="caption-text">Placing Dockerfile in the directory where we want to create Docker image</span><a class="headerlink" href="#id1" title="Link to this image"></a></p>
|
|
|
</figcaption>
|
|
|
</figure>
|
|
|
<p>We can examine the contents of the Dockerfile.</p>
|
|
|
<p>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 <a class="reference external" href="https://hub.docker.com/search?q=nvidia%2Fcuda">Docker Hub</a> (<a class="reference external" href="https://hub.docker.com/search?q=nvidia%2Fcuda">https://hub.docker.com/search?q=nvidia%2Fcuda</a>).</p>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># -----------------------------------------------------------------------------------------</span>
|
|
|
<span class="c1"># Step 1 : Import a base image from online repository</span>
|
|
|
<span class="c1"># FROM nvidia/cuda:12.5.0-devel-ubuntu22.04</span>
|
|
|
FROM<span class="w"> </span>nvidia/cuda:12.4.0-devel-ubuntu22.04
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<figure class="align-center" id="id2">
|
|
|
<a class="reference internal image-reference" href="_images/docker.png"><img alt="_images/docker.png" src="_images/docker.png" style="width: 1200px;" /></a>
|
|
|
<figcaption>
|
|
|
<p><span class="caption-text">Find base images online via <cite>Docker Hub <https://hub.docker.com/search?q=nvidia%2Fcuda></cite></span><a class="headerlink" href="#id2" title="Link to this image"></a></p>
|
|
|
</figcaption>
|
|
|
</figure>
|
|
|
<p>In addition, setting <code class="docutils literal notranslate"><span class="pre">ENV</span> <span class="pre">DEBIAN_FRONTEND=noninteractive</span></code> in a Dockerfile is a directive that adjusts the environment variable <code class="docutils literal notranslate"><span class="pre">DEBIAN_FRONTEND</span></code> within the Docker container during the image build process.</p>
|
|
|
<ul class="simple">
|
|
|
<li><p><strong>Non-interactive Environment</strong></p></li>
|
|
|
</ul>
|
|
|
<p>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.</p>
|
|
|
<ul class="simple">
|
|
|
<li><p><strong>Avoiding User Prompts</strong></p></li>
|
|
|
</ul>
|
|
|
<p>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.</p>
|
|
|
<ul class="simple">
|
|
|
<li><p><strong>Common Usage in Dockerfiles</strong></p></li>
|
|
|
</ul>
|
|
|
<p>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.</p>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># -----------------------------------------------------------------------------------------</span>
|
|
|
<span class="c1"># Step 2 : Suppress Interactive Prompts from Debian</span>
|
|
|
ENV<span class="w"> </span><span class="nv">DEBIAN_FRONTEND</span><span class="o">=</span>noninteractive
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<p>Next, we will need to install packages, libraries and set the environment variables that we need to compile or run Maxwell-TD.</p>
|
|
|
<p>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:</p>
|
|
|
<ul class="simple">
|
|
|
<li><dl class="simple">
|
|
|
<dt><strong>Update system and install libraries</strong></dt><dd><ul>
|
|
|
<li><p><strong>Purpose</strong>: Updates the package list and installs a set of essential libraries and tools required for compiling and building various applications.</p></li>
|
|
|
<li><dl class="simple">
|
|
|
<dt><strong>Packages Installed</strong>:</dt><dd><ul>
|
|
|
<li><p><strong>build-essential, g++, gcc</strong>: Compiler tools and libraries.</p></li>
|
|
|
<li><p><strong>cmake, gfortran</strong>: Build and Fortran compiler.</p></li>
|
|
|
<li><p>Various development libraries (libopenblas-dev, liblapack-dev, libfftw3-dev, etc.) for numerical computations, linear algebra, and scientific computing.</p></li>
|
|
|
<li><p><strong>libvtk7-dev</strong>: Libraries for 3D computer graphics, visualization, and image processing.</p></li>
|
|
|
<li><p><strong>libgomp1, libomp-dev, libpthread-stubs0-dev</strong>: Libraries for multi-threading support.</p></li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</li>
|
|
|
<li><dl class="simple">
|
|
|
<dt><strong>Install Compilers</strong></dt><dd><p>-<strong>Purpose</strong>: Ensures that g++ and gcc are installed. These are essential compilers for C++ and C programming languages, often needed for compiling native code.</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</li>
|
|
|
<li><dl class="simple">
|
|
|
<dt><strong>Install Python and pip</strong></dt><dd><p>-<strong>Purpose</strong>: Installs Python 3 and pip (Python package installer), which are essential for Python-based applications and managing Python dependencies.</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</li>
|
|
|
<li><dl class="simple">
|
|
|
<dt><strong>Copy current directory to docker image</strong></dt><dd><p>-<strong>Purpose</strong>: Sets the working directory inside the Docker image to <code class="docutils literal notranslate"><span class="pre">/dgtd</span></code> and copies all files from the current directory (presumably where the Dockerfile resides) into the <code class="docutils literal notranslate"><span class="pre">/dgtd</span></code> directory inside the Docker image.</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</li>
|
|
|
<li><dl class="simple">
|
|
|
<dt><strong>Install Python dependencies</strong></dt><dd><p>-<strong>Purpose</strong>: Installs Python dependencies listed in <code class="docutils literal notranslate"><span class="pre">requirements.txt</span></code> file located in the /dgtd directory. The <code class="docutils literal notranslate"><span class="pre">--no-cache-dir</span></code> flag ensures that no cached packages are used during installation, which can be important for Docker images to maintain consistency and avoid unexpected behavior.</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</li>
|
|
|
<li><dl class="simple">
|
|
|
<dt><strong>Set Path for libraries and CUDA</strong></dt><dd><p>-<strong>Purpose</strong>: 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 (<code class="docutils literal notranslate"><span class="pre">nvcc</span></code>).</p>
|
|
|
</dd>
|
|
|
</dl>
|
|
|
</li>
|
|
|
</ul>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># -----------------------------------------------------------------------------------------</span>
|
|
|
<span class="c1"># Step 3 : Installing required packages and setting up environment variables</span>
|
|
|
|
|
|
<span class="c1"># Update system and install libraries</span>
|
|
|
RUN<span class="w"> </span>apt-get<span class="w"> </span>update<span class="w"> </span><span class="o">&&</span><span class="w"> </span>apt-get<span class="w"> </span>install<span class="w"> </span>-y<span class="w"> </span><span class="se">\</span>
|
|
|
<span class="w"> </span>build-essential<span class="w"> </span><span class="se">\</span>
|
|
|
<span class="w"> </span>cmake<span class="w"> </span><span class="se">\</span>
|
|
|
<span class="w"> </span>gfortran<span class="w"> </span><span class="se">\</span>
|
|
|
<span class="w"> </span>libopenblas-dev<span class="w"> </span><span class="se">\</span>
|
|
|
<span class="w"> </span>liblapack-dev<span class="w"> </span><span class="se">\</span>
|
|
|
<span class="w"> </span>libfftw3-dev<span class="w"> </span><span class="se">\</span>
|
|
|
<span class="w"> </span>libmetis-dev<span class="w"> </span><span class="se">\</span>
|
|
|
<span class="w"> </span>libvtk7-dev<span class="w"> </span><span class="se">\</span>
|
|
|
<span class="w"> </span>libgomp1<span class="w"> </span><span class="se">\</span>
|
|
|
<span class="w"> </span>libomp-dev<span class="w"> </span><span class="se">\</span>
|
|
|
<span class="w"> </span>libblas-dev<span class="w"> </span><span class="se">\</span>
|
|
|
<span class="w"> </span>libpthread-stubs0-dev<span class="w"> </span><span class="se">\</span>
|
|
|
<span class="w"> </span><span class="o">&&</span><span class="w"> </span>rm<span class="w"> </span>-rf<span class="w"> </span>/var/lib/apt/lists/*
|
|
|
|
|
|
<span class="c1"># Install Compilers</span>
|
|
|
RUN<span class="w"> </span>apt-get<span class="w"> </span>update<span class="w"> </span><span class="o">&&</span><span class="w"> </span>apt-get<span class="w"> </span>install<span class="w"> </span>-y<span class="w"> </span>g++<span class="w"> </span>gcc
|
|
|
|
|
|
<span class="c1"># Install Python and pip</span>
|
|
|
RUN<span class="w"> </span>apt-get<span class="w"> </span>install<span class="w"> </span>-y<span class="w"> </span>python3<span class="w"> </span>python3-pip
|
|
|
|
|
|
<span class="c1"># Copy current directory to docker image</span>
|
|
|
WORKDIR<span class="w"> </span>dgtd
|
|
|
COPY<span class="w"> </span>.<span class="w"> </span>.
|
|
|
|
|
|
<span class="c1"># Install Python dependencies</span>
|
|
|
RUN<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>--no-cache-dir<span class="w"> </span>-v<span class="w"> </span>-r<span class="w"> </span>/dgtd/requirements.txt
|
|
|
|
|
|
|
|
|
<span class="c1"># Set Path for libraries and CUDA</span>
|
|
|
ENV<span class="w"> </span>CUDA_HOME<span class="w"> </span>/usr/local/cuda
|
|
|
ENV<span class="w"> </span>LD_LIBRARY_PATH<span class="w"> </span><span class="si">${</span><span class="nv">CUDA_HOME</span><span class="si">}</span>/lib64
|
|
|
ENV<span class="w"> </span>PATH<span class="w"> </span><span class="si">${</span><span class="nv">CUDA_HOME</span><span class="si">}</span>/:bin:<span class="si">${</span><span class="nv">PATH</span><span class="si">}</span>
|
|
|
ENV<span class="w"> </span>CPATH<span class="w"> </span><span class="si">${</span><span class="nv">CUDA_HOME</span><span class="si">}</span>/include:<span class="si">${</span><span class="nv">CPATH</span><span class="si">}</span>
|
|
|
ENV<span class="w"> </span>CUDACXX<span class="w"> </span><span class="si">${</span><span class="nv">CUDA_HOME</span><span class="si">}</span>/bin/nvcc
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<p>Finally, we can compile a program using cmake and make, and then sets up the Docker container to start a Bash shell upon running. <code class="docutils literal notranslate"><span class="pre">CMD</span> <span class="pre">["bash"]</span></code> 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.</p>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># -----------------------------------------------------------------------------------------</span>
|
|
|
<span class="c1"># Step 4 : Compiling Program</span>
|
|
|
RUN<span class="w"> </span>ls<span class="w"> </span>-l<span class="w"> </span><span class="o">&&</span><span class="w"> </span>mkdir<span class="w"> </span>build<span class="w"> </span><span class="o">&&</span><span class="w"> </span><span class="nb">cd</span><span class="w"> </span>build<span class="w"> </span><span class="o">&&</span><span class="w"> </span>cmake<span class="w"> </span>..<span class="w"> </span><span class="o">&&</span><span class="w"> </span>make<span class="w"> </span>-j<span class="w"> </span><span class="m">4</span>
|
|
|
CMD<span class="w"> </span><span class="o">[</span><span class="s2">"bash"</span><span class="o">]</span>
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<ol class="arabic simple" start="2">
|
|
|
<li><p>Use the <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">build</span></code> command to build the Docker image from your Dockerfile.</p></li>
|
|
|
</ol>
|
|
|
<p>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:</p>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker<span class="w"> </span>build<span class="w"> </span>-t<span class="w"> </span>maxwell_td_image<span class="w"> </span>.
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<ul class="simple">
|
|
|
<li><p><code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">build</span></code>: This command tells Docker to build an image from a Dockerfile.</p></li>
|
|
|
<li><p><code class="docutils literal notranslate"><span class="pre">-t</span> <span class="pre">maxwell_td_image</span></code>: 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.</p></li>
|
|
|
<li><p><code class="docutils literal notranslate"><span class="pre">.</span></code>: 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.</p></li>
|
|
|
</ul>
|
|
|
<figure class="align-center" id="id3">
|
|
|
<a class="reference internal image-reference" href="_images/P7.png"><img alt="_images/P7.png" src="_images/P7.png" style="width: 1200px;" /></a>
|
|
|
<figcaption>
|
|
|
<p><span class="caption-text">Run docker build to build Docker image</span><a class="headerlink" href="#id3" title="Link to this image"></a></p>
|
|
|
</figcaption>
|
|
|
</figure>
|
|
|
</section>
|
|
|
<section id="how-to-check-images">
|
|
|
<h2>How to check images<a class="headerlink" href="#how-to-check-images" title="Link to this heading"></a></h2>
|
|
|
<p>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:</p>
|
|
|
<ul class="simple">
|
|
|
<li><p>Open your terminal (Command Prompt on Windows or Terminal on macOS/Linux).</p></li>
|
|
|
<li><p>Run the following command</p></li>
|
|
|
</ul>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker<span class="w"> </span>images
|
|
|
docker<span class="w"> </span>images<span class="w"> </span>ls
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<p>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.</p>
|
|
|
<ul class="simple">
|
|
|
<li><p>Finding your image</p></li>
|
|
|
</ul>
|
|
|
<p>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.</p>
|
|
|
<ul class="simple">
|
|
|
<li><p>Confirming successful build</p></li>
|
|
|
</ul>
|
|
|
<p>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.</p>
|
|
|
<figure class="align-center" id="id4">
|
|
|
<a class="reference internal image-reference" href="_images/P8.png"><img alt="_images/P8.png" src="_images/P8.png" style="width: 1200px;" /></a>
|
|
|
<figcaption>
|
|
|
<p><span class="caption-text">Check Docker image</span><a class="headerlink" href="#id4" title="Link to this image"></a></p>
|
|
|
</figcaption>
|
|
|
</figure>
|
|
|
</section>
|
|
|
<section id="how-to-save-built-image-locally">
|
|
|
<h2>How to save built image locally<a class="headerlink" href="#how-to-save-built-image-locally" title="Link to this heading"></a></h2>
|
|
|
<p>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:</p>
|
|
|
<ul class="simple">
|
|
|
<li><p>Open your terminal (Command Prompt on Windows or Terminal on macOS/Linux).</p></li>
|
|
|
<li><p>Run the following command</p></li>
|
|
|
</ul>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker<span class="w"> </span>save<span class="w"> </span>-o<span class="w"> </span><output-file-name>.zip<span class="w"> </span><image-name>
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<p>Replace <code class="docutils literal notranslate"><span class="pre"><output-file-name>.zip</span></code> with the desired name for your zip archive file.</p>
|
|
|
<p><image-name>: This specifies the Docker image you want to save.</p>
|
|
|
<ul class="simple">
|
|
|
<li><p>Confirmation:</p></li>
|
|
|
</ul>
|
|
|
<p>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.</p>
|
|
|
<figure class="align-center" id="id5">
|
|
|
<a class="reference internal image-reference" href="_images/P9.png"><img alt="_images/P9.png" src="_images/P9.png" style="width: 1200px;" /></a>
|
|
|
<figcaption>
|
|
|
<p><span class="caption-text">Save Docker image</span><a class="headerlink" href="#id5" title="Link to this image"></a></p>
|
|
|
</figcaption>
|
|
|
</figure>
|
|
|
<figure class="align-center" id="id6">
|
|
|
<a class="reference internal image-reference" href="_images/P10.png"><img alt="_images/P10.png" src="_images/P10.png" style="width: 1200px;" /></a>
|
|
|
<figcaption>
|
|
|
<p><span class="caption-text">Resulting zipped Docker image</span><a class="headerlink" href="#id6" title="Link to this image"></a></p>
|
|
|
</figcaption>
|
|
|
</figure>
|
|
|
<div class="admonition note">
|
|
|
<p class="admonition-title">Note</p>
|
|
|
<ul class="simple">
|
|
|
<li><p>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.</p></li>
|
|
|
<li><p>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.</p></li>
|
|
|
<li><p>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:</p></li>
|
|
|
</ul>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker<span class="w"> </span>load<span class="w"> </span>-i<span class="w"> </span><path/to/your/image.tar>
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<p>Replace <path/to/your/image.tar> with the actual path to your saved tar archive file.</p>
|
|
|
</div>
|
|
|
</section>
|
|
|
<section id="managing-docker-resources">
|
|
|
<h2>Managing Docker Resources<a class="headerlink" href="#managing-docker-resources" title="Link to this heading"></a></h2>
|
|
|
<p><strong>Cleaning Up Unused Resources</strong></p>
|
|
|
<p>To clean up any dangling resources (images, containers, volumes, networks), use the following command:</p>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker<span class="w"> </span>system<span class="w"> </span>prune
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<p>To remove stopped containers and all unused images (not just dangling), add the <cite>-a</cite> flag:</p>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker<span class="w"> </span>system<span class="w"> </span>prune<span class="w"> </span>-a
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<p><strong>Removing Docker Images</strong></p>
|
|
|
<p>To remove specific images, list them using <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">images</span> <span class="pre">-a</span></code> and then delete them with <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">rmi</span></code>:</p>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker<span class="w"> </span>images<span class="w"> </span>-a<span class="w"> </span><span class="c1"># List all images</span>
|
|
|
docker<span class="w"> </span>rmi<span class="w"> </span>Image<span class="w"> </span>Image<span class="w"> </span><span class="c1"># Remove specific images by ID or tag</span>
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<p>To remove dangling images, use:</p>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker<span class="w"> </span>image<span class="w"> </span>prune
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<p><strong>Removing Docker Containers</strong></p>
|
|
|
<p>To remove specific containers, list them using <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">ps</span> <span class="pre">-a</span></code> and then delete them with <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">rm</span></code>:</p>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker<span class="w"> </span>ps<span class="w"> </span>-a<span class="w"> </span><span class="c1"># List all containers</span>
|
|
|
docker<span class="w"> </span>rm<span class="w"> </span>ID_or_Name<span class="w"> </span>ID_or_Name<span class="w"> </span><span class="c1"># Remove specific containers by ID or name</span>
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<p>To remove all exited containers, use:</p>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker<span class="w"> </span>rm<span class="w"> </span><span class="k">$(</span>docker<span class="w"> </span>ps<span class="w"> </span>-a<span class="w"> </span>-f<span class="w"> </span><span class="nv">status</span><span class="o">=</span>exited<span class="w"> </span>-q<span class="k">)</span>
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<p><strong>Removing Docker Volumes</strong></p>
|
|
|
<p>To remove specific volumes, list them using <cite>docker volume ls</cite> and then delete them with <cite>docker volume rm</cite>:</p>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker<span class="w"> </span>volume<span class="w"> </span>ls<span class="w"> </span><span class="c1"># List all volumes</span>
|
|
|
docker<span class="w"> </span>volume<span class="w"> </span>rm<span class="w"> </span>volume_name<span class="w"> </span>volume_name<span class="w"> </span><span class="c1"># Remove specific volumes by name</span>
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<p>To remove dangling volumes, use:</p>
|
|
|
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>docker<span class="w"> </span>volume<span class="w"> </span>prune
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
</section>
|
|
|
</section>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
|
|
|
<a href="desktop.html" class="btn btn-neutral float-left" title="Docker Desktop" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
|
|
|
<a href="Manual.html" class="btn btn-neutral float-right" title="User Manual (Windows System)" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
|
|
</div>
|
|
|
|
|
|
<hr/>
|
|
|
|
|
|
<div role="contentinfo">
|
|
|
<p>© Copyright 2024.</p>
|
|
|
</div>
|
|
|
|
|
|
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
|
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
|
|
provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
|
|
|
|
|
|
|
</footer>
|
|
|
</div>
|
|
|
</div>
|
|
|
</section>
|
|
|
</div>
|
|
|
<script>
|
|
|
jQuery(function () {
|
|
|
SphinxRtdTheme.Navigation.enable(true);
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
</html> |