Skip to content

Instantly share code, notes, and snippets.

Last active May 20, 2021 12:46
Show Gist options
  • Save snikch/ab15159e633d21619bdf6a056bec8830 to your computer and use it in GitHub Desktop.
Save snikch/ab15159e633d21619bdf6a056bec8830 to your computer and use it in GitHub Desktop.
Chia Network Docker Compose

Chia Network w/ Docker

This makes using the Chia network very easy, especially via CLI as Chia have now moved to an electron app. Testing with beta-1.0b8-dev at time of writing.


Build the docker image

docker build -t chia .

Set up ENV

Set up a .env file, see .env.example. You'll want a fast drive for tmp, and a big drive for final. Worst case, just use the same drive.


An example config.yaml will be added soon, however here is a list of the modifications that need to be made.

  • Replace with the appropriate host. Since each process runs as a container at a unique hostname (the service name), we need to direct traffic to the correct host. This is generally replacing the key xxx_peer: to xxx_peer: xxx, e.g. farmer_peer: farmer since the farmer will be available at the hostname farmer.
  • Set start_rpc_server: false. We don't need the rpc server, as it is designed to allow interprocess communication when everything is all running and hidden, and to manage services / processes. We interact directly by running and stopping docker containers instead.
  • Update plots.yml to change your local dir to the mounted dir, i.e. /plots-final/plot-knn-yyyy-mm-dd-hh-MM-xxxxxxxxxx.dat.



# Init your config
docker-compose run init

# Generate your keys
docker-compose run generate_keys


# Start Generating some Plots
docker-compose up -d create_plots
# Alternate invocation
docker-compose up -d -e PLOT_K=30 -e PLOT_N=10 create_plots


docker-compose up -d full_node
docker-compose up -d farmer
docker-compose up -d harvester


  • config.yml with appropriate hosts and ports for running components internally
version: '2.2'
x-base: &base
image: chia
- ${CHIA_ROOT:-~/.chia}:/root/.chia/
- ${PLOTS_TMP_DIR?}:/plots-tmp
- ${PLOTS_FINAL_DIR?}:/plots-final
- ${CHIA_KEYRING_ROOT:-~/.local/share/python_keyring/}:/root/.local/share/python_keyring/
# Base chia command, useful for arbitrary chia runs, e.g.
# docker-compose run chia keys show
<<: *base
entrypoint: chia
<<: *base
command: chia init
<<: *base
command: chia keys generate
<<: *base
- chia-create-plots
- -k ${PLOT_K:-30}
- -n ${PLOT_N:-1}
- -t /plots-tmp
- -2 /plots-tmp
- -d /plots-final
<<: *base
#command: chia_full_node
command: python3 src/server/
<<: *base
#command: chia_farmer
command: python3 src/server/
<<: *base
#command: chia_harvester
command: python3 src/server/
FROM ubuntu:20.04
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y python3.8-venv python3.8-distutils python3-pip git
RUN git clone /opt/chia-blockchain
WORKDIR /opt/chia-blockchain
# Temp workaround until 1.0beta8 is release to master.
RUN git checkout dev
RUN python3.8 -m pip install wheel
RUN python3.8 -m pip install -i miniupnpc==2.1 setproctitle==1.1.10 cbor2==5.1.0
RUN python3.8 -m pip install -e .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment