Code Monkey home page Code Monkey logo

chia-docker's Introduction

Official Chia Docker Container

Quick Start

These examples shows valid setups using Chia for both docker run and docker-compose. Note that you should read some documentation at some point, but this is a good place to start.

Docker run

docker run --name chia -d ghcr.io/chia-network/chia:latest --expose=8444 -v /path/to/plots:/plots

Syntax

docker run --name <container-name> -d ghcr.io/chia-network/chia:latest 
optional accept incoming connections: --expose=8444
optional: -v /path/to/plots:/plots

Docker compose

version: "3.6"
services:
  chia:
    container_name: chia
    restart: unless-stopped
    image: ghcr.io/chia-network/chia:latest
    ports:
      - 8444:8444
    volumes:
      - /path/to/plots:/plots

Configuration

You can modify the behavior of your Chia container by setting specific environment variables.

Timezone

Set the timezone for the container (optional, defaults to UTC). Timezones can be configured using the TZ env variable. A list of supported time zones can be found here

-e TZ="America/Chicago"

Add your custom keys

To use your own keys pass as arguments on startup (post 1.0.2 pre 1.0.2 must manually pass as shown below)

-v /path/to/key/file:/path/in/container -e keys="/path/in/container"

or pass keys into the running container

docker exec -it <container-name> venv/bin/chia keys add

alternatively you can pass in your local keychain, if you have previously deployed chia with these keys on the host machine

-v ~/.local/share/python_keyring/:/root/.local/share/python_keyring/

or if you would like to persist the entire mainnet subdirectory and not touch the key directories at all

-v ~/.chia/mainnet:/root/.chia/mainnet -e keys="persistent"

Persist configuration and db

You can persist whole db and configuration, simply mount it to Host.

-v ~/.chia:/root/.chia

Farmer only

To start a farmer only node pass

-e farmer="true"

Harverster only

To start a harvester only node pass

-e harvester="true" -e farmer_address="addres.of.farmer" -e farmer_port="portnumber" -v /path/to/ssl/ca:/path/in/container -e ca="/path/in/container" -e keys="copy"

Plots

The plots_dir environment variable can be used to specify the directory containing the plots, it supports PATH-style colon-separated directories.

Or, you can cimply mount /plots path to your host machine.

Log level

To set the log level to one of CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET

-e log_level="DEBUG"

Docker Compose

version: "3.6"
services:
  chia:
    container_name: chia
    restart: unless-stopped
    image: ghcr.io/chia-network/chia:latest
    ports:
      - 8444:8444
    environment:
      # Farmer Only    
#     - farmer=true
      # Harvester Only
#     - harvester=true
#     - farmer_address=192.168.0.10 
#     - farmer_port=8447
#     - ca=/path/in/container
#     - keys=copy
      # Harvester Only END
      # If you would like to add keys manually via mnemonic file
#     - keys=/path/in/container
      # OR
      # Disable key generation on start
#     - keys=
      - TZ=${TZ}
    volumes:
      - /path/to/plots:/plots
      - /home/user/.chia:/root/.chia
#     - /home/user/mnemonic:/path/in/container

CLI

You can run commands externally with venv (this works for most chia CLI commands)

docker exec -it chia venv/bin/chia plots add -d /plots

Is it working?

You can see status from outside the container

docker exec -it chia venv/bin/chia show -s -c

or

docker exec -it chia venv/bin/chia farm summary

Connect to testnet?

docker run -d --expose=58444 -e testnet=true --name chia ghcr.io/chia-network/chia:latest

Need a wallet?

To get new wallet, execute command and follow the prompts:

docker exec -it chia-farmer1 venv/bin/chia wallet show

Building

docker build -t chia --build-arg BRANCH=latest .

chia-docker's People

Contributors

7ac avatar arderos avatar cmmarslender avatar davidbarratt avatar dudeofawesome avatar gas85 avatar gilbertgong avatar gnomuz avatar jinnatar avatar justinengland avatar kemp avatar linnik avatar mengland17 avatar nirajpathak13 avatar npathak13 avatar skweee avatar sparklyballs avatar stogiec avatar stonemelody avatar thdxr avatar thelastcicada avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.