I'm confused about how to get/access geth that is inside the container.

So far I have:

docker pull ethereum/client-go

it seems though that this image is designed to work on the public network. do i have to make my own dockerfile?

What do I need to include in that dockerfile and how do I access geth?

Should geth be installed on the 'host' os/where the image/containers are or can it be solely in the docker container?

3 Answers 3


If you want to create a private network, you need to create your own genesis file (see the "Operating a private network" section of the documentation of the client-go Docker image.

If you create that in a folder, and then are on the command line in that folder, running:

docker run --name ethereum-node -v ${PWD}:/private-data \
   ethereum/client-go init /private-data/genesis.json

Should initialize the node.

Then you should be able to bring up the node with the command they give:

docker run -d --name ethereum-node -v /Users/alice/ethereum:/root \
   -p 8545:8545 -p 30303:30303 \
   ethereum/client-go --fast --cache=512

If you want to attach to that running node to get at the Javascript CLI, do:

docker exec -it ethereum-node /user/bin/geth attach

Geth does not need to be installed on the host OS, it can just reside in the Docker container. If you want to control where the blockchain data gets saved, you can alter the -v commands to point to a different location in the host OS to store the data the container generates.

  • Ah I see. I didn't realize the genesis.json could exist outside the image. i don't know why I thought it had to be part of the image. So I can further use the docker exec command to get geth to run the container as an executable? So could I do: docker exec -it ethereum-node /user/bin/geth --version and it'll show me the version of geth?
    – karn
    Jun 9, 2017 at 5:48
  • 2
    I don't think I can docker run with the second command. how do i get the container running after I init it?
    – karn
    Jun 9, 2017 at 7:40

I have been working on something like this, but not using the official images - https://github.com/the-chaingang/ethereal

If you have access to docker-compose, you should be able to bring up a private network with a docker-compose up.

The Dockerfile and entrypoint code should help you get started re: geth installation, etc.

Hope that helped.


We published a Docker container here and a tutorial of how to use it here. This Ethereum environment can also be used with Remix and MetaMask to develop and debug smart contracts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.