# Docker Method

{% hint style="warning" %}
This guide is quoted from <https://docs.aldebaranode.xyz/guide/testnet/cortensor/installation>

All rights reserved to [Aldebaranode](https://aldebaranode.xyz)
{% endhint %}

### Prerequisites

Ensure that you meet the hardware requirements to run the Cortensor network. For detailed information, you can visit the [official website](https://docs.cortensor.network/getting-started/quick-start-guide#hardware-requirements).

### Step 1 - Install Docker

Run the following command to uninstall all conflicting packages:

{% code overflow="wrap" %}

```sh
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
```

{% endcode %}

Set up Docker’s apt repository.

{% code overflow="wrap" %}

```sh
# 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 "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \  
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
```

{% endcode %}

Install the Docker packages.

{% code overflow="wrap" %}

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

{% endcode %}

### Step 2 - Clone Installer Repository

Install Git to clone the installer repository.

```sh
sudo apt-get install git -y
```

{% code overflow="wrap" %}

```sh
git clone https://github.com/CryptoNodeID/cortensor-docker.git && cd cortensor-docker
```

{% endcode %}

### Step 3 - Config Docker Compose

Run the build.sh script. The script will do the following:

* Build the Dockerfile for the Cortensor image
* Generate the docker-compose.yaml file for you to adjust your total nodes

```sh
bash build.sh
```

After the <kbd>docker-compose.yml</kbd> and <kbd>.env</kbd> files are generated, you need to modify the environment variables in <kbd>.env</kbd> file for the cortensor section:

* **RPC\_URL**: Your ARB Sepolia RPC URL, which you can obtain by running your own node or using a service provider like Ankr, Alchemy, or Infura.
* **ETH\_RPC\_URL**: Your ETH Mainnet RPC URL, you can use any free provider
* **CONTRACT\_ADDRESS\_RUNTIME**: DevNet#5 Runtime is `0x8361E7821bDAD7F8F0aC7862Bebb190B8Da1A160`
* **NODE\_PUBLIC\_KEY\_X**: The EVM address of your miner node.
* **NODE\_PRIVATE\_KEY\_X**: The EVM private key of your miner node.

{% hint style="success" %} <kbd>X</kbd> means number of your node.\
If you're going to run 5 nodes, there will be&#x20;

NODE\_PUBLIC\_KEY\_1=0x...\
NODE\_PRIVATE\_KEY\_1=0x...\
NODE\_PUBLIC\_KEY\_2=0x...\
NODE\_PRIVATE\_KEY\_2=0x...\
...\
NODE\_PUBLIC\_KEY\_5=0x...\
NODE\_PRIVATE\_KEY\_5=0x...
{% endhint %}

### Step 4 - Run the Nodes

Ensure that the working directory is within the installer folder.

Run your nodes using this command

```sh
docker compose up -d
```

Run this command to check all the container logs

```sh
docker compose logs --tail 100 -f
```

Run this command to stop the nodes

```sh
docker compose down
```

Run this command to delete all nodes

```sh
docker compose rm
```

## Update Instruction

You can simply run below command inside the working directory to get latest update

For DevNet#5 onwards

```sh
git pull
bash upgrade.sh
```

For DevNet#4 and below, it's recommended to do full rebuild

```sh
git pull
bash build.sh
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cryptonode.id/en/testnet/cortensor/multiple-node-setup/docker-method.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
