> For the complete documentation index, see [llms.txt](https://docs.creditcoin.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.creditcoin.org/validator-guides/using-a-docker-container.md).

# Using a Docker container

#### Sync Chain Data <a href="#sync-chain-data" id="sync-chain-data"></a>

Ensure Docker is installed (or [install it in your OS of choice](https://docs.docker.com/engine/install/)) and run the `gluwa/creditcoin3` Docker image.

### Using Docker to run a Mainnet node

#### Generating a network p2p key (Necessary for new Mainnet nodes starting 3.52.0)

Starting v3.52.0, **new nodes that intend to be validators will no longer generate a network key automatically on start-up**. Validator nodes in existence prior to v3.52.0 do not need to make changes to how they handle the network key. When setting up a new node, run the following command to generate and store on disk the network key that will be referenced in the start-up command:

```
docker run --name creditcoin-validator -p 30333:30333 -v <your local data path>:/creditcoin-node/data gluwa/creditcoin3:3.66.0-mainnet key generate-node-key --chain mainnet --base-path <your-base-path> --bin
```

The command will output a node peer ID. It will also generate a secret for the node key and insert it into the correct path&#x20;

(`<your local path>/creditcoin-node/data/chains/creditcoin3/network/secret_ed25519`).&#x20;

You can also take a look at other ways to generate the node key file inside the [Starting a Node](/validator-guides/notes-for-starting-a-node.md) section

**CAUTION**: This step can be bypassed using the --unsafe-force-node-key-generation argument in the start-up command. This parameter forces the generation of a new network key even if one already exists under the network folder or if the system would normally prevent its generation under certain conditions.

Attempting to run a validator without its network key configured will result in the following error:

```
Error: NetworkKeyNotFound("/data/chains/creditcoin3/network/secret_ed25519")
```

{% hint style="info" %}
Docker should automatically pull the specified `gluwa/creditcoin3` image. If not, you can try pulling it yourself from DockerHub by running `docker pull gluwa/creditcoin3:3.128.0-mainnet` and then re-running the command below.
{% endhint %}

{% hint style="warning" %}
PowerShell does not support comments on multiline commands, please use the uncommented version.
{% endhint %}

{% tabs %}
{% tab title="Bash" %}

```
docker run \
 --name creditcoin-validator \
 -p 30333:30333 \
 -v <your local data path>:/creditcoin-node/data  \
 gluwa/creditcoin3:3.128.0-mainnet `# Enter latest mainnet image` \
 --name "validator name" `# name the validator` \
 --telemetry-url "wss://telemetry.creditcoin.network/submit/ 0" `# (optional) opt in to telemetry` \
 --public-addr "/dns4/<yourhostname or ip>/tcp/30333" `# REPLACE <yourhostname or ip> with the public IP address or host name at which your node can be reached` \
 --chain /mainnetSpecRaw.json `# we want to connect to mainnet` \
 --bootnodes "/dns4/cc3-bootnode.creditcoin.network/tcp/30333/p2p/12D3KooWLGyvbdQ3wTGjRAEueFsDnstZnV8fN3iyPTmHeyswSPGy" \
 --validator `# if we want to run a validator node` \
 --base-path /creditcoin-node/data `# the base path to store the node's data` \
 --port 30333 # the port to use for node-to-node communications
```

{% endtab %}

{% tab title="Uncommented Bash" %}

```
docker run \
 --name creditcoin-validator \
 -p 30333:30333 \
 -v <your local data path>:/creditcoin-node/data  \
 gluwa/creditcoin3:3.128.0-mainnet \
 --name "validator name" \
 --telemetry-url "wss://telemetry.creditcoin.network/submit/ 0"  \
 --public-addr "/dns4/<yourhostname or ip>/tcp/30333" \
 --chain /mainnetSpecRaw.json \
 --bootnodes "/dns4/cc3-bootnode.creditcoin.network/tcp/30333/p2p/12D3KooWLGyvbdQ3wTGjRAEueFsDnstZnV8fN3iyPTmHeyswSPGy" \
 --validator \
 --base-path /creditcoin-node/data \
 --port 30333
```

{% endtab %}

{% tab title="PowerShell" %}

```
docker run `
  --name creditcoin-validator `
  -p 30333:30333 `
  -v <your local data path>:/creditcoin-node/data `
# Enter mainnet image
  gluwa/creditcoin3:3.128.0-mainnet `
# name the validator
  --name "validator name" `
# (optional) opt in to telemetry
  --telemetry-url "wss://telemetry.creditcoin.network/submit/ 0" `
# REPLACE <yourhostname or ip> with the public IP address or host name that your node can be reached at
  --public-addr "/dns4/<yourhostname or ip>/tcp/30333" `
# we want to connect to mainnet
  --chain /mainnetSpecRaw.json `
# we want to run a validator node
  --bootnodes "/dns4/cc3-bootnode.creditcoin.network/tcp/30333/p2p/12D3KooWLGyvbdQ3wTGjRAEueFsDnstZnV8fN3iyPTmHeyswSPGy" `
  --validator `
# the base path to store the node's data
  --base-path /creditcoin-node/data `
# the port to use for node-to-node communication
  --port 30333
```

{% endtab %}

{% tab title="Uncommented PowerShell" %}

```
docker run `
  --name creditcoin-validator `
  -p 30333:30333 `
  -v <your local data path>:/creditcoin-node/data `
  gluwa/creditcoin3:3.128.0-mainnet `
  --name "validator name" `
  --telemetry-url "wss://telemetry.creditcoin.network/submit/ 0" `
  --public-addr "/dns4/<yourhostname or ip>/tcp/30333" `
  --chain /mainnetSpecRaw.json `
  --bootnodes "/dns4/cc3-bootnode.creditcoin.network/tcp/30333/p2p/12D3KooWLGyvbdQ3wTGjRAEueFsDnstZnV8fN3iyPTmHeyswSPGy" `
  --validator `
  --base-path /creditcoin-node/data `
  --port 30333
```

{% endtab %}
{% endtabs %}

In the command above, notice the `-v` flag that takes a local directory as the first part of the parameter. It's important that Docker has the ability to write to this directory, otherwise, you will see errors such as `Error: Service(Client(Backend("IO Error: Permission denied (os error 13)")))`. Your command will likely use a path similar to `-v /home/validator/data:/creditcoin-node/data`.

Here is an example command to run a validator that connects to the Creditcoin **Mainnet**:

```
docker run \
-p 30333:30333 \
-v ~/chain_data:/data \
gluwa/creditcoin3:3.128.0-mainnet \
--bootnodes "/dns4/cc3-bootnode.creditcoin.network/tcp/30333/p2p/12D3KooWLGyvbdQ3wTGjRAEueFsDnstZnV8fN3iyPTmHeyswSPGy" \
--chain /mainnetSpecRaw.json \
--validator \
--base-path /data \
--port 30333
```

### Using Docker to run a Testnet node

#### Generating a network p2p key (Necessary for new Testnet nodes starting 3.47.0)

Starting v3.47.0, **new nodes that intend to be validators will no longer generate a network key automatically on start-up**. Validator nodes in existence prior to v3.47.0 do not need to make changes to how they handle the network key. When setting up a new node, run the following command to generate and store on disk the network key that will be referenced in the start-up command:

```
docker run --name creditcoin-validator -p 30333:30333 -v <your local data path>:/creditcoin-node/data gluwa/creditcoin3:3.128.0-testnet key generate-node-key --chain testnet --base-path <your-base-path> --bin
```

The command will output a node peer ID. It will also generate a secret for the node key and insert it into the correct path&#x20;

(`<your local path>/creditcoin-node/data/chains/creditcoin3-testnet/network/secret_ed25519`).&#x20;

You can also take a look at other ways to generate the node key file inside the [Starting a Node](/validator-guides/notes-for-starting-a-node.md) section

**CAUTION**: This step can be bypassed using the --unsafe-force-node-key-generation argument in the start-up command. This parameter forces the generation of a new network key even if one already exists under the network folder or if the system would normally prevent its generation under certain conditions.

Attempting to run a validator without its network key configured will result in the following error:

```
Error: NetworkKeyNotFound("/data/chains/creditcoin3_testnet/network/secret_ed25519")
```

{% hint style="info" %}
Docker should automatically pull the specified `gluwa/creditcoin3` image. If not, you can try pulling it yourself from DockerHub by running `docker pull gluwa/creditcoin3:3.121.0-testnet` and then re-running the command below.
{% endhint %}

{% hint style="warning" %}
PowerShell does not support comments on multiline commands, please use the uncommented version.
{% endhint %}

{% tabs %}
{% tab title="Bash" %}

```
docker run \
 --name creditcoin-validator \
 -p 30333:30333 \
 -v <your local data path>:/creditcoin-node/data  \
 gluwa/creditcoin3:3.128.0-testnet `# Enter latest testnet image` \
 --name "validator name" `# name the validator` \
 --telemetry-url "wss://telemetry.creditcoin.network/submit/ 0" `# (optional) opt in to telemetry` \
 --public-addr "/dns4/<yourhostname or ip>/tcp/30333" `# REPLACE <yourhostname or ip> with the public IP address or host name at which your node can be reached` \
 --chain testnet `# we want to connect to the testnet` \
 --bootnodes "/dns4/cc3-test-bootnode.creditcoin.network/tcp/30333/p2p/12D3KooWAxmsWr6iEjFyLqQBzfLvbCRTAhYBeszyr8UWgQx6Zu7K" \
 --validator `# we want to run a validator node` \
 --base-path /creditcoin-node/data `# the base path to store the node's data` \
 --port 30333 # the port to use for node-to-node communications
```

{% endtab %}

{% tab title="Uncommented Bash" %}

```
docker run \
 --name creditcoin-validator \
 -p 30333:30333 \
 -v <your local data path>:/creditcoin-node/data  \
 gluwa/creditcoin3:3.128.0-testnet \
 --name "validator name" \
 --telemetry-url "wss://telemetry.creditcoin.network/submit/ 0" \
 --public-addr "/dns4/<yourhostname or ip>/tcp/30333" \
 --chain testnet \
 --bootnodes "/dns4/cc3-test-bootnode.creditcoin.network/tcp/30333/p2p/12D3KooWAxmsWr6iEjFyLqQBzfLvbCRTAhYBeszyr8UWgQx6Zu7K" \
 --validator \
 --base-path /creditcoin-node/data \
 --port 30333
```

{% endtab %}

{% tab title="PowerShell" %}

```
docker run `
  --name creditcoin-validator `
  -p 30333:30333 `
  -v <your local data path>:/creditcoin-node/data `
# Enter testnet image
  gluwa/creditcoin3:3.128.0-testnet `
# name the validator
  --name "validator name" `
# (optional) opt in to telemetry
  --telemetry-url "wss://telemetry.creditcoin.network/submit/ 0" `
# REPLACE <yourhostname or ip> with the public IP address or host name that your node can be reached at
  --public-addr "/dns4/<yourhostname or ip>/tcp/30333" `
# we want to connect to the testnet
  --chain testnet `
# we want to run a validator node
  --bootnodes "/dns4/cc3-test-bootnode.creditcoin.network/tcp/30333/p2p/12D3KooWAxmsWr6iEjFyLqQBzfLvbCRTAhYBeszyr8UWgQx6Zu7K" `
  --validator `
# the base path to store the node's data
  --base-path /creditcoin-node/data `
# the port to use for node-to-node communication
  --port 30333
```

{% endtab %}

{% tab title="Uncommented PowerShell" %}

```
docker run `
  --name creditcoin-validator `
  -p 30333:30333 `
  -v <your local data path>:/creditcoin-node/data `
  gluwa/creditcoin3:3.128.0-testnet `
  --name "validator name" `
  --telemetry-url "wss://telemetry.creditcoin.network/submit/ 0" `
  --public-addr "/dns4/<yourhostname or ip>/tcp/30333" `
  --chain testnet `
  --bootnodes "/dns4/cc3-test-bootnode.creditcoin.network/tcp/30333/p2p/12D3KooWAxmsWr6iEjFyLqQBzfLvbCRTAhYBeszyr8UWgQx6Zu7K" `
  --validator `
  --base-path /creditcoin-node/data `
  --port 30333
```

{% endtab %}
{% endtabs %}

In the command above, notice the `-v` flag that takes a local directory as the first part of the parameter. It's important that Docker has the ability to write to this directory, otherwise, you will see errors such as `Error: Service(Client(Backend("IO Error: Permission denied (os error 13)")))`. Your command will likely use a path similar to `-v /home/validator/data:/creditcoin-node/data`.

Here is an example command to run a validator that connects to the Creditcoin **Testnet**:

```
docker run \
-p 30333:30333 \
-v ~/chain_data:/data \
gluwa/creditcoin3:3.128.0-testnet \
--bootnodes "/dns4/cc3-test-bootnode.creditcoin.network/tcp/30333/p2p/12D3KooWAxmsWr6iEjFyLqQBzfLvbCRTAhYBeszyr8UWgQx6Zu7K" \
--chain testnet \
--validator \
--base-path /data \
--port 30333
```
