# Running on Docker

We provide a docker containerized distribution of the Quanta Core which can be used to run on Linux, OSX, or Windows platform. Docker nicely runs the linux environment required for the quanta-core instance, in an isolated environment.

Docker image: <https://hub.docker.com/r/quantalabs/quanta-core>

The image opens two ports 1) 8090 which is the websocket RPC service, and 2) 1776  a p2p service to communicate with other nodes.

### &#x20;Installing Docker

On windows, install docker from docker official page, <https://docs.docker.com/docker-for-windows/install/> , or from [download.docker.com](https://download.docker.com/win/stable/Docker%20for%20Windows%20Installer.exe).

![](https://3282115274-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LR5UzIByyCOIOHd5CFf%2F-L_jDaO8apyzZwoIfdcM%2F-L_jSkI9AHwkhsuzl0bn%2Fimage.png?alt=media\&token=82867a22-0dd2-4dcf-a8e3-4198efa2a689)

NOTE: It will ask you to logout and log back into the system. Next it will enable Hyper-V which is a windows technology that powers the virtual machine.  You may get an error about BIOS not enabled for virtualization. You need to enter your BIOS typically with DEL, ESC, or F10 when the machine boots up. From inside the bios you need to find a Virtualization Technology (VTx) and enable it. For my HP machine, this[ visual guide](https://blogs.technet.microsoft.com/canitpro/2015/09/08/step-by-step-enabling-hyper-v-for-use-on-windows-10/) was helpful.

### Preparing the Data

Next, download our pre-built docker-compose configuration and quanta configuration file. Dropbox [link](https://www.dropbox.com/s/63giyanitrbsx29/quanta-docker-prepare.zip?dl=0).   Now, unzip the content to a directory where you will store the data for the quanta chain, where preferably you have  100GB+ in free space.   Next, click on the Docker icon on the system tray, settings, and enable the drive where the folder is located to be shared with the docker. This allows docker to write the data back to your drive for persistent storage.

![](https://3282115274-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LR5UzIByyCOIOHd5CFf%2F-L_nAZ-xfHdtpAAVuKGy%2F-L_nEB8Z9cgbD5n4Abbo%2Fshare_drive.PNG?alt=media\&token=5be74677-c580-4b21-bf7a-bd6a95cc8c0a)

### Running the QUANTA Node

Open up Terminal (from search / Terminal). Change directory to where your data directory. For example this is change directory command for C:\quanta&#x20;

```
cd C:\quanta
```

Next, let's run the node.  This command below will start the quanta-node in the background (-d parameter for detached). It's going to download the latest docker image from the cloud and boot up.

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

![](https://3282115274-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LR5UzIByyCOIOHd5CFf%2F-L_nGeD00XeS74F3lnSl%2F-L_nGFX5RWh-ifL8tkR0%2Fdocker_up.PNG?alt=media\&token=a30319ce-5edb-4a52-ae3c-e2ea88ecd35c)

#### Checking the logs

Let's verify whether the node ran properly.  You should see it trying to fetch the blocks from the beginning. This will take 30-60 minutes to fetch all the blocks from the network.

```
docker-compose logs -f quantacore
```

![](https://3282115274-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LR5UzIByyCOIOHd5CFf%2F-L_nElsWr3jxpV5JgTGK%2F-L_nFRkMgt9PtoOZ3mzA%2Fdocker_success.PNG?alt=media\&token=c0b8247a-dd6d-4998-867d-af888b08f921)

After it gets all the blocks, you will see it receiving individual blocks and network transactions, which means the system is operating properly, like so:

```
3552003ms th_a       application.cpp:515           handle_block         ] Got block: #6865536 0068c28028d6e7d2a43e67cb443088a419503b98 time: 2019-03-12T06:59:12 transaction(s): 0 latency: 3 ms from: clockbound-witness  irreversible: 6865532 (-4)
3553123ms th_a       application.cpp:515           handle_block         ] Got block: #6865537 0068c28196a9dde7b150ea8dec24e8c719922b96 time: 2019-03-12T06:59:13 transaction(s): 0 latency: 123 ms from: flash-witness  irreversible: 6865532 (-5)
3553356ms th_a       application.cpp:571           handle_transaction   ] Got 1 transactions from network
3554127ms th_a       application.cpp:515           handle_block         ] Got block: #6865538 0068c282c369bf31220aeaf40431ab44f97ce3c2 time: 2019-03-12T06:59:14 transaction(s): 1 latency: 127 ms from: quantalabs-witness  irreversible: 6865532 (-6)
```

### Stopping the node

To stop the node, run

```
docker-compose down
```

### Accessing your wallet

This runs the wallet in a separate VM environment. The wallet file points to the same location as you config directory.

```
docker-compose run quantacore /usr/local/bin/cli_wallet --wallet-file=/etc/bitshares/quanta_wallet.json --server-rpc-endpoint=ws://quantacore:8090 --chain-id bb2aeb9eebaaa29d79ed81699ee49a912c19c59b9350f8f8d3d81b12fa178495
```

The first time you create a wallet, you will need set the password.

```
set_password XXX
```

Unlocking the password

```
unlock XXX
```

Query global properties: very useful to see active witnesses, prices, etc.

```
get_global_properties
```

Query on object. Every piece of data such as account, witness, block have [object ids](http://docs.bitshares.org/development/blockchain/objects.html).  Anything that has x.y.z  (eg. 1.3.0) can be query with:

```
get_object 1.3.0
```

Query an account

```
get_full_account alpha
```

Importing your key

```
import_key alpha "5JXXXXXXX"
```

To Transfer 10 QDEX from alpha to charlie

```
transfer alpha charlie 10 QDEX "memo line" true
```

Registering a new account with quanta\_foundation paying for the registration of the account and quanta\_foundation receiving the referral fee.  You would need to replace at least the registration account that you can unlock to pay for the fee.

```
register_account market-maker2 QA6vEzxzP1GE6z9S1A8MnNCZPCSe9BP9pJMR2ATnycBzonpiTTSw QA6vEzxzP1GE6z9S1A8MnNCZPCSe9BP9pJMR2ATnycBzonpiTTSw quanta_foundation quanta_foundation 0 true
```

For more commands:

Please see [Wallet API on Graphene.](http://docs.bitshares.org/api/wallet-api.html)

### Switch to Mainnet

Instructions to switch to mainnet

1. create a new directory eg. C:/quanta-mainnet
2. unzip the prepare files
3. edit docker-compose.yml
   1. change out **quantalabs/quanta-core:latest with** the latest image name ending with "m" for mainnet from <https://hub.docker.com/r/quantalabs/quanta-core/tags>
4. edit the config.ini
   1. seed-nodes = \["54.203.105.154:4600","54.203.105.154:4600"]
   2. If you're a block producer, change the **witness-id** and the **private-key** fields.
5. docker-compose up -d
6. docker-compose logs -f
7. you should see that we have a new chain id: 9809209586f5aef6c4c8f5c24ee2d7c4104b64f951b1c32355e3d7d93fe16daa

### Upgrading

First step is to update the image version to the target version. In this case the version is 1.83-mainnet, and make sure REPLAY is o

```
version: '2.2'
services:
  quantacore:
    image: quantalabs/quanta-core:1.83-mainnet
    environment:
      - cluster.name=docker-cluster
      - BITSHARESD_PLUGINS=witness market_history
      - BITSHARESD_REPLAY=1
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - ./data:/var/lib/bitshares
      - ./config:/etc/bitshares
```

Next run retrieve the image:

```
docker pull quantalabs/quanta-core:1.83-mainnet
```

Then, restart the node, and force it to use the same new image.

```
docker-compose up -d --force-recreate quantacore
```


---

# 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://quanta.gitbook.io/documentation/getting-started/running-on-docker.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.
