Introduction to Docker
Tags: docker, tutorial, openexchange, webdev
Published: 2023-09-16 09:32:07

### Hi Community,

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">In this article, we will learn the below topics listed below:</span></span></span></span></span></span>

  1. <div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;">
      What is Docker?
    </div>

  2. <div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;">
      Some of the Docker benefits
    </div>

  3. <div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;">
      How does Docker work?
    </div>

  4. <div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;">
      Docker Image
    </div>

  5. <div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;">
      Docker Container
    </div>

  6. <div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;">
      Docker Image repository
    </div>

  7. <div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;">
      InterSystems's Docker image repository
    </div>

  8. <div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;">
      Docker Installation
    </div>

  9. <div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;">
      Docker Basic Commands
    </div>

 10. <div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;">
      Running IRIS community edition by using docker
    </div>

 11. <div style="background:#eeeeee;border:1px solid #cccccc;padding:5px 10px;">
      Docker Desktop GUI
    </div>

So Let's start.

##  
1. What is Docker?

![A beginner’s guide to Docker — how to create your first Docker application](https://i.imgur.com/UlnvjIH.png)  
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Docker is Virtualization software that makes developing and deploying applications very easy. Docker does this by Packaging the application into a so-called <strong>container</strong> that retains everything the application needs to run, including the application's actual code, its libraries and dependencies, runtime, and environment configuration.</span></span></span></span></span></span>

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Docker is a containerization platform that allows developers to create, deploy, and run applications in containerized environment. Docker provides a way to package an application and its dependencies into a single container that can be run on any machine that supports Docker. That makes it easy to create portable, lightweight applications that can be deployed quickly and effortlessly.</span></span></span></span></span></span>

##  
2. Some of the Docker benefits

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Below you can find some of the benefits of using the Docker:</span></span></span></span></span></span>

<li aria-level="1" style="list-style-type:disc">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">Portability</span></span></span></span></span></span><span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> Docker containers can be run on any machine that supports Docker, making it easy to deploy applications across different environments.</span></span></span></span></span></span>
</li>
<li aria-level="1" style="list-style-type:disc">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">Consistency</span></span></span></span></span></span><span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> By packaging an application and its dependencies into a container, Docker ensures that the application will run consistently, regardless of the underlying infrastructure.</span></span></span></span></span></span>
</li>
<li aria-level="1" style="list-style-type:disc">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">Scalability</span></span></span></span></span></span><span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> Docker makes it painless to scale applications horizontally by running multiple instances of the same container.</span></span></span></span></span></span>
</li>
<li aria-level="1" style="list-style-type:disc">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">Resource efficiency</span></span></span></span></span></span><span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> Docker containers are lightweight and require minimal resources, making them ideal for running on cloud infrastructure.</span></span></span></span></span></span>
</li>
  * <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:700"><span style="font-style:normal"><span style="text-decoration:none">Security</span></span></span></span></span></span><span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> Docker provides a secure and isolated environment for running applications, reducing the risk of conflicts with other applications or the host system.</span></span></span></span></span></span>

###  

## **3. How does Docker work?**

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Docker creates a virtualized environment for an application called a container. A container is a lightweight, standalone and executable package that incorporates everything needed to run the application, including code, libraries, and dependencies. Containers are isolated from the host system. Therefore, they can run on any machine that supports Docker, regardless of the underlying operating system or hardware.</span></span></span></span></span></span>

<p style="line-height:1.38; margin-top:16px; margin-bottom:16px">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Containers are created from images which are read-only templates that define the application and its dependencies. Those images are stored in a central repository, called a registry, such as Docker Hub or a private registry. Developers can create custom images themselves or use pre-built ones from the registry.</span></span></span></span></span></span>
</p>

<p style="line-height:1.38; margin-top:16px; margin-bottom:16px">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">When a container is launched, it gets built from an image and given its own isolated file system, network, and process space. The container can then run the application as if it were running on a dedicated server.</span></span></span></span></span></span>
</p>

##  

## 4. Docker Images

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">A Docker image is a lightweight, standalone, and executable package that retains everything required to execute an application, including the code, libraries, and dependencies. Docker images are employed to build and run containers, which are isolated environments that can be used to run applications.</span></span></span></span></span></span>

<p style="line-height:1.38; margin-top:16px; margin-bottom:16px">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Docker images are built from a Dockerfile, which is a text file that contains a set of instructions for building the image. The Dockerfile specifies the base image, the application code and dependencies, the environment variables, and other configuration options necessary for creating the image.</span></span></span></span></span></span>
</p>

<p style="line-height:1.38; margin-top:16px; margin-bottom:16px">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Docker images are stored in a registry, such as Docker Hub or a private one. Every time when a container is created from an image, it runs as a separate process on the host machine, isolated from other processes and containers.</span></span></span></span></span></span>
</p>

<p style="line-height:1.38; margin-top:16px; margin-bottom:16px">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Docker images can be used to deploy applications in a consistent way across different platforms. They make it easy to package, distribute, and deploy applications, and ensure that they run the same way everywhere.</span></span></span></span></span></span>
</p>

 

## 5. Docker Containers

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">A running instance of an image is a Container, which, as mentioned above, is a lightweight, standalone, and executable package that includes everything needed to run an application, including the code, libraries, and dependencies.</span></span></span></span></span></span>

<p style="line-height:1.38; margin-top:16px; margin-bottom:16px">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">A Docker container provides an isolated environment for running an application, ensuring that it has all the resources it needs to run correctly. Each container runs as a separate process on the host machine and has its own file system, network, and other resources.</span></span></span></span></span></span>
</p>

<p style="line-height:1.38; margin-top:16px; margin-bottom:16px">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Docker containers are designed to be portable and easy to deploy. They can be run on any machine that has Docker installed, regardless of the underlying operating system or hardware. Containers provide a consistent environment for running applications, making it more comfortable to move applications between different environments, such as development, testing, and production.</span></span></span></span></span></span>
</p>

<p style="line-height:1.38; margin-top:16px; margin-bottom:16px">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Docker containers can be managed with the help of the Docker CLI or such Docker tools as Docker Compose or Kubernetes. They can be started, stopped, paused, and restarted as needed. They can also be monitored and managed using a range of tools and platforms.</span></span></span></span></span></span>
</p>

<p style="line-height:1.38; margin-top:16px; margin-bottom:16px">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Overall, Docker containers provide a flexible and scalable way to package and deploy applications, making it less complicated to manage and scale complex applications across different environments and platforms.</span></span></span></span></span></span>
</p>

 

## 6. Docker Images Repository

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Docker hosts one of the biggest Docker Repositories, called</span></span></span></span></span></span>[<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span>](https://hub.docker.com/) <a href="https://hub.docker.com/" rel="nofollow"><strong>Docker Hub</strong></a>.<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none"> </span></span></span></span></span></span><span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Roboto,sans-serif"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">It is a storage and distribution system for Docker images. It provides a central repository for developers and organizations to share and distribute their Docker images, making it more enjoyable to build, share, and deploy applications with Docker.</span></span></span></span></span></span>

<p style="line-height:1.38; margin-top:16px; margin-bottom:16px">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Docker Hub allows users and organizations to store and manage their Docker images and also provides such features as versioning, tagging, and collaboration. Users can search for and download images from Docker Hub, as well as publish their own images to the registry.</span></span></span></span></span></span>
</p>

<p style="line-height:1.38; margin-top:16px; margin-bottom:16px">
  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">In addition to the public registry, Docker Hub provides a private registry for organizations that want to manage their own Docker images and ensure that they are only accessible to authorized users.</span></span></span></span></span></span>
</p>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zx2wkvnw43azzoyw7pxr.png)

###  

###  

## 7. InterSystems Docker image repository

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">By using the Docker Hub search feature, we can find InterSystems images on Docker hub.</span></span></span></span></span></span>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/630uhj75n9aom6alfelq.png) 

###  

## 8. Installation of Docker

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">In order to use Docker, we need to install it on our system. Docker provides installation packages for various operating systems, including Windows, macOS, and Linux.</span></span></span></span></span></span>  
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Navigate to</span></span></span></span></span></span> <a href="https://docs.docker.com/get-docker/" rel="nofollow"><strong>Docker website</strong></a>.  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">We can download the installation package from the Docker website, run the installer, and follow the prompts to complete the installation.</span></span></span></span></span></span>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bmra4p77ylzedowylj3x.png) 

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">After installing Docker Desktop, we can use the Docker CLI (Command Line Interface) to manage Docker images, containers, networks, and other resources.  </span></span></span></span></span></span>

##  

## 9. Docker Basic Commands

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Here we will review some of the docker CLI basic commands. (Make sure to run Docker Desktop before using the commands detailed below)</span></span></span></span></span></span>

**9.1 List images (locally)**  
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">We can use the </span></span></span></span></span></span> `docker image ls` <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">command to list all the Docker images that are available on our system. Here's how you can use this command:</span></span></span></span></span></span>

<pre class="codeblock-container" idlang="12" lang="Shell Session" tabsize="4"><code class="language-shell hljs">docker image ls</code></pre>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/owemz7eid86xrn570nbf.png) 
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">As you can see, currently, we do not have any images locally</span></span></span></span></span></span>  
  
  
**9.2 Pull images from the Docker repository**

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">We can use the</span></span></span></span></span></span> `docker pull` <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">command to download a Docker image from a registry</span></span></span></span></span></span>

<pre class="codeblock-container" idlang="12" lang="Shell Session" tabsize="4"><code class="language-shell hljs">docker pull <image></code></pre>

Let us pull intersystemsdc/iris-community image from the docker hub  

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8oy1eyessrd4cq0bevc4.png) 
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">At this point, we should use the list command to view images locally</span></span></span></span></span></span>  

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgwvtbihp2q10jf8z58y.png) 
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Well done! The iris-community image was pulled successfully</span></span></span></span></span></span>

  
**9.3 Remove image locally**  
We can use the `docker image rm`  command to delete the image from our system

<pre class="codeblock-container" idlang="12" lang="Shell Session" tabsize="4"><code class="language-shell hljs">docker image rm <image name></code></pre>

 

**9.4 List all existing containers (running and not running)**  
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">We can employ the </span></span></span></span></span></span> `docker ps` command to list down running containers

<pre class="codeblock-container" idlang="12" lang="Shell Session" tabsize="4"><code class="language-shell hljs">docker ps </code></pre>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g801tiu0bm27b1zh3ym2.png)  
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">As shown in the picture, no container is running at this time.</span></span></span></span></span></span>

**9.5 Create and start the container**  
We can use the `docker run` command to create and start the container

<pre class="codeblock-container" idlang="12" lang="Shell Session" tabsize="4"><code class="language-shell hljs">docker run <image id/namge></code></pre>

Let's create and start the container from iris-community image  

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ejvt9hdb6patbcey611r.png)
Here `-d` or `--detach `<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:'Roboto Mono',monospace"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">means the following</span></span></span></span></span></span><span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">: Run the command in the background and return control to the terminal.</span></span></span></span></span></span>

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">It is time to list down running containers once more</span></span></span></span></span></span>

<pre class="codeblock-container" idlang="12" lang="Shell Session" tabsize="4"><code class="language-shell hljs">docker ps</code></pre>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/11hrb6firvtdel5z93g1.png) 

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">We can see that our iris-community image container is running now.</span></span></span></span></span></span>

**9.6 Stop the specific container**  
We can use the `docker stop` command to stop the running container

<pre class="codeblock-container" idlang="12" lang="Shell Session" tabsize="4"><code class="language-shell hljs">docker stop <container id/name></code></pre>

 

**9.7 Start the specific container**  
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">We can use the</span></span></span></span></span></span> `docker start` <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">command to start a previously stopped container in Docker. </span></span></span></span></span></span>

<pre class="codeblock-container" idlang="12" lang="Shell Session" tabsize="4"><code class="language-shell hljs">docker start <container id/name></code></pre>

**9.8 Restart the specific container**

We can use the `docker restart` command to stop and start the running container in the Docker

<pre class="codeblock-container" idlang="12" lang="Shell Session" tabsize="4"><code class="language-shell hljs">docker restart <container id/name></code></pre>

**9.9 Remove the specific container**

We can use the `docker rm` command to remove the **stopped** container

<pre class="codeblock-container" idlang="12" lang="Shell Session" tabsize="4"><code class="language-shell hljs">docker rm <container id/name></code></pre>

 

**9.10 Running a command inside a running container**  
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">We can employ the </span></span></span></span></span></span> `docker exec` <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">command to run a command inside a running container. It can come in handy when performing administrative tasks or for debugging purposes.</span></span></span></span></span></span>

<pre class="codeblock-container" idlang="12" lang="Shell Session" tabsize="4"><code class="language-shell hljs">docker exec -it my-container sh</code></pre>

Some common options for the `docker exec` command are:

  * `-i` or `--interactive`:  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">this command keeps STDIN open even if not attached, allowing you to interact with the container.</span></span></span></span></span></span>
  * `-t` or `--tty`:  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">this command allocates a pseudo-TTY to the command, allowing you to use terminal commands inside the container.</span></span></span></span></span></span>
  * `-d` or `--detach`:  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">this runs the command in the background and returns control to the terminal.</span></span></span></span></span></span>

 

## 10. Running IRIS community edition by using docker

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Utilize the command listed below to run the container by employing the iris-community image</span></span></span></span></span></span>

<pre class="codeblock-container" idlang="12" lang="Shell Session" tabsize="4"><code class="language-shell hljs">docker run -d -p 52773:52773 intersystemsdc/iris-community</code></pre>

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Some common options for the</span></span></span></span></span></span> `docker exec` <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">command are the following:</span></span></span></span></span></span>

  * `-d` <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">: this command is used to start a new Docker container in detached mode, it means that the container will run in the background, and we can continue to use the terminal for other tasks.</span></span></span></span></span></span>
  * `-p`:  <span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">this command helps us publish a container's port to the host machine to make it possible to access the container from outside the Docker network.</span></span></span></span></span></span>

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">In the illustration below you can spot IRIS running in the Docker.</span></span></span></span></span></span>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/seq39txpgy0ww52zdqdy.png)

##  

## 11. Docker Desktop GUI

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Docker desktop also has GUI where we can utilize all the above-mentioned commands graphically.</span></span></span></span></span></span>


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ognz66694x2cfs1html.png)

##  

## Summary

<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Docker is a powerful tool that allows developers and IT teams to create, deploy, and run applications in a containerized environment. By providing portability, consistency, scalability, resource efficiency, and security, Docker makes it easy to deploy applications across different environments and infrastructures. With the growing popularity of containerization, Docker is becoming an essential tool for modern software development and deployment.</span></span></span></span></span></span>  
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">In the upcoming article, we will learn how to use Docker file (employed to build a Docker image), Docker compose (a YAML file that specifies the configuration options for each container in the application), and Docker volume (a persistent data storage mechanism operated to share data between Docker containers and the host machine.)</span></span></span></span></span></span>

 

  
<span style="font-size:11pt; font-variant:normal; white-space:pre-wrap"><span style="font-family:Arial"><span style="color:#000000"><span style="font-weight:400"><span style="font-style:normal"><span style="text-decoration:none">Thank you for reading!</span></span></span></span></span></span>