> For the complete documentation index, see [llms.txt](https://docs.emc.network/emc-testnet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.emc.network/emc-testnet/emc-airdrop-guidelines/testnet-tutorial-guide/linux-tutorial/docker-installation-and-nvidia-gpu-configuration.md).

# Docker Installation and NVIDIA GPU Configuration

## 1. Docker Installation and Setup

### &#x20;1.1 Docker Installation and Verification

\#**Install Docker :**

{% code lineNumbers="true" %}

```powershell
# Docker Installation
sudo apt-get install docker.io
```

{% endcode %}

**#Docker Verification Installation Success:**

{% code lineNumbers="true" %}

```powershell
# Refer Docker Version
docker version

# Check for Multiple Docker Installations
which docker
```

{% endcode %}

<div data-full-width="false"><figure><img src="/files/Ff5mqDUaRoqkfD8ECC2D" alt=""><figcaption><p><br></p></figcaption></figure></div>

The image above shows that Docker is installed successfully.

### 1.2 Docker Daemon Remote Access

The Docker Daemon is a core component of Docker, running in the background and managing requests from the Docker Client. The Docker Client interacts with Docker Daemon via the command line to perform Docker operations.The Docker Daemon listens on a specific port for requests from the Docker Client. It creates and runs jobs based on the request type to pull images, start containers, and stop containers.<br>

**Modify docker.service File to Open Port 2375**

To facilitate EMC test mining, open TCP port 2375 for Docker Daemon. This allows it to listen and create jobs.&#x20;

For more information, visit: <https://docs.docker.com/engine/daemon/remote-access/>

The `docker.service` file is located in the systemd folder. To configure it by modifying `docker.service`, first check if your system uses systemd.

{% code lineNumbers="true" %}

```powershell
stat /sbin/init
```

{% endcode %}

<figure><img src="/files/B65Xb9rXhz3WJniywHPh" alt=""><figcaption></figcaption></figure>

As shown in the image, the system uses `systemd.`

Proceed by using the following command to modify the `docker.service` file:

{% code lineNumbers="true" %}

```powershell
sudo vim /lib/systemd/system/docker.service
```

{% endcode %}

<figure><img src="/files/D4nBvv9PafSFpFXuiko1" alt=""><figcaption></figcaption></figure>

As shown in the image, add <mark style="color:red;">`-H tcp://127.0.0.1:2375`</mark> to the specified location in the file. Press `ESC`, then type <mark style="color:red;">`:wq`</mark> to save and exit.

Use **`systemctl`** to reload the **`Docker Daemon`**&#x61;nd apply the changes:

> Systemctl provides a set of subcommands to manage a single unit, with the command format: systemctl \[command] \[unit].

{% code lineNumbers="true" %}

```powershell
sudo systemctl daemon-reload
sudo systemctl unmask docker.service
sudo systemctl unmask docker.socket
```

{% endcode %}

Restart Docker service:

{% code lineNumbers="true" %}

```PowerShell
sudo systemctl restart docker.service
```

{% endcode %}

<figure><img src="/files/doLNCYO8CQInWpUtaD9v" alt=""><figcaption></figcaption></figure>

The image shows that if the Docker service runs as expected after modifying the <mark style="color:red;">`docker.service`</mark> unit, the modification is successful. If issues occur, examine the modification process for errors.

### Verify if port 2375 is open

Enter the following command in the cloud server terminal:

{% code lineNumbers="true" %}

```powershell
netstat -apn | grep 2375
```

{% endcode %}

<figure><img src="/files/T2zIWJT1Tt3G1E20O9gF" alt=""><figcaption></figcaption></figure>

As shown in the image, <mark style="color:red;">port TCP 2375</mark> is open, and Docker Daemon is listening.

## 2. NVIDIA GPU configuration

Configure the NVIDIA GPU on the cloud server to enable seamless GPU usage within containers for optimal performance.

### 2.1 NVIDIA Container Runtime Installation and Usage

With NVIDIA Container Runtime, users register a new runtime during container creation to expose NVIDIA GPUs to applications within the container.

**#Add Library**

{% code lineNumbers="true" %}

```powershell
curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list
sudo apt-get update
```

{% endcode %}

**#Install nvidia-container-runtime**

{% code lineNumbers="true" %}

```PowerShell
sudo apt-get install nvidia-container-runtime
systemctl restart docker
```

{% endcode %}

**#Ensure successful installation**

{% code lineNumbers="true" %}

```PowerShell
sudo docker run --gpus all --rm nvidia/cuda:12.0.1-base-ubuntu22.04 nvidia-smi
```

{% endcode %}

**Note:**&#x54;he command should match your Ubuntu version. For more details, visit: [NVIDIA CUDA Containers](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda).: <https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda>

<figure><img src="/files/2VWyT541RNH38buZ7f6c" alt=""><figcaption></figcaption></figure>

As shown in the image, the NVIDIA Container Runtime installation is successful.

You have successfully completed all the necessary steps for the EMC testnet mining setup.
