Member-only story
Setup a Private Blockchain using Geth and Docker
This article provides step-by-step detailed guidelines to deploy a private blockchain using ethereum/client-go aka geth (go-ethereum) on docker.
If you’re reading this I assume that you already know blockchain 101 and basics of docker. Because in this article I’m more focussed on GETH commands and solving issues while deploying the ethereum/client-go docker image. Note that I followed the instructions given in go-ethereum docs but it was not enough to bring the system live and working on docker hence, writing this for you.
1. Run the Docker Image
- First thing first. You have to pull the right version (tag) of the docker image before you run it. Choose
ethereum/client-go:alltools-stable
in https://hub.docker.com/r/ethereum/client-go. You don’t get other tools likebootnode
orclef
packed with the image if you chose a version withoutalltools
. - Then it’s important to mount a volume, otherwise you have to edit the config files in the terminal which is a cumbersome process.
- When it comes to port mapping, use
0.0.0.0:<host_port>:<container_port>
to make yourhost_port
accessible to other users in your private network. - So here’s the command you should run to start the docker container for go-ethereum. You can change the host port and volume mount path as you want.