# Run with Docker

Please ensure that [Docker ](https://docs.exsat.network/others/operation-references/preparation-before-you-start/prerequisites#running-with-docker)is installed on your Linux server.

## 1. Download docker image

```
docker pull exsatnetwork/exsat-client:latest
```

## 2. Download and configure the environment variables (.env)

Please create a directory (e.g., `$HOME/.exsat/`) to store the files for running the exSat Client via Docker. We will download the `.env` file directly from GitHub into this directory, and edit it.

```
mkdir -p $HOME/.exsat/
curl -o $HOME/.exsat/.env https://raw.githubusercontent.com/exsat-network/exsat-client/main/.env.example
vim $HOME/.exsat/.env
```

Please ensure all configurations are correctly set. Some settings can also be adjusted in the next steps. Detailed configurations can be found [here](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/common-operations/environment-variables).

## 3. Initialize the account and configure the Client

Start Docker in interactive mode：

```
docker run -it --name commander -v $HOME/.exsat/:/app/.exsat -e CLIENT_TYPE=commander exsatnetwork/exsat-client:latest
```

Perform below actions in the docker.

### 3.1 Initiate the synchronizer account

#### Create or import the account

If you don't have a synchronizer account, please [create a new account](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/synchronizer-operations/create-new-synchronizer-account).

If you already have a synchronizer account, and wish to import it to your client, please [import seed phase](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/common-operations/import-from-seed-phrase) or [import private key](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/common-operations/import-from-private-key).

#### Register account as synchronizer

If you didn't register your account as synchronizer, please [register as synchronizer.](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/synchronizer-operations/synchronizer-registration)

### 3.2 Configurations

You can complete some client configurations or perform operations on your account:

* [Set BTC RPC Node](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/common-operations/set-btc-rpc-node) (**required**, can also be done by editing the .env file)
* [Bridge BTC for gas fee ](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/common-operations/refill-btc-for-gas-fees)(**required**)
* [Change Reward Account](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/synchronizer-operations/change-reward-address) (optional)
* [Export private key](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/common-operations/export-private-key) (optional)
* [Remove your account](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/common-operations/remove-your-account) (optional)

## 4. Execute the Client

Please ensure that you have [configured the BTC RPC Node](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/common-operations/set-btc-rpc-node) and [Bridge BTC for gas fee](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/common-operations/refill-btc-for-gas-fees).

There are several ways to start the client using Docker, differing in how the keystore password is provided. Choose the method you prefer.

Assuming the keystore file is stored at `$HOME/.exsat/synctest_keystore.json`and the password is `123456` .the keystore file path in ".env" file should be look like:

```
SYNCHRONIZER_KEYSTORE_FILE=/app/.exsat/synctest_keystore.json
```

### Option1 : Password stored in ".env"

&#x20;Configure password in the `.env` file:

```
SYNCHRONIZER_KEYSTORE_PASSWORD=123456
```

Then, start the Docker container with the following command:

```
docker run -d --restart always --name synctest -v $HOME/.exsat/:/app/.exsat -e CLIENT_TYPE=synchronizer exsatnetwork/exsat-client:latest
```

### Option2 : Input password in the command

Start docker container with the password as parameter in the command:

```
docker run -d --restart always --name synctest -v $HOME/.exsat/:/app/.exsat -e CLIENT_TYPE=synchronizer -e SYNCHRONIZER_KEYSTORE_PASSWORD=123456 exsatnetwork/exsat-client:latest
```

### Option 3 : Interactive Password Input

Start Docker in interactive mode and enter the password in the command line interface.

```
docker run -it --name synctest -v $HOME/.exsat:/app/.exsat -e CLIENT_TYPE=synchronizer exsatnetwork/exsat-client:latest
```

> Different startup methods vary in terms of security and convenience. If you start the client interactively and enter the password in the interface, the password won't be stored in plain text in the startup command or files, reducing the risk of exposure. However, if you provide the password in the `.env` file or directly in the command line, it may be more prone to leakage but offers greater convenience during startup.

If your Synchronizer Client is running correctly, the following logs should appear on your screen:

```
2025-02-28T12:34:59.176+00:00 info: ExsatApi initialized successfully.
2025-02-28T12:34:59.934+00:00 info: synchronizer[synctest.sat] client configurations are correct, and the startup was successful
2025-02-28T12:35:00.939+00:00 info: Upload block task is running
2025-02-28T12:35:00.942+00:00 info: Verify block task is running
2025-02-28T12:35:00.945+00:00 info: Parse block task is running
```

Check [this guide](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/common-operations/view-logs) for detailed instructions on viewing the logs.

## 5. Check and claim rewards

You could [check and claim rewards ](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/synchronizer-operations/check-and-claim-rewards-for-synchronizer)on the front-page with the reward address.

## 6. Update to new Docker image

Please refer to the [Docker version update](https://docs.exsat.network/guides-of-data-consensus/others/operation-references/synchronizer-operations/update-to-new-docker-version-for-synchronizer) instruction.
