I need geth to run in a docker container and connect to the Rinkeby network. When I started it using

docker run -d \
    -v $HOME/geth:/root \
    -p 8545:8545 -p 30303:30303 \
    --name geth \
    ethereum/client-go --rinkeby --fast --cache=512 \
    --rpc --rpcaddr \

the docker image will run then quit within seconds. docker ps shows that geth is no longer running.

docker logs geth shows

WARN [10-04|20:42:16] No etherbase set and no accounts found as default
INFO [10-04|20:42:16] Starting peer-to-peer node               instance=Geth/v1.7.2-unstable/linux-amd64/go1.9
INFO [10-04|20:42:16] Allocated cache and file handles         database=/root/.ethereum/rinkeby/geth/chaindata cache=512 handles=1024
INFO [10-04|20:42:17] Initialised chain configuration          config="{ChainID: 4 Homestead: 1 DAO: <nil> DAOSupport: true EIP150: 2 EIP155: 3 EIP158: 3 Byzantium: 1035301 Engine: clique}"
INFO [10-04|20:42:17] Initialising Ethereum protocol           versions="[63 62]" network=4
INFO [10-04|20:42:17] Loaded most recent local header          number=2156 hash=8ecd4a…9fc640 td=4248
INFO [10-04|20:42:17] Loaded most recent local full block      number=0    hash=6341fd…67e177 td=1
INFO [10-04|20:42:17] Loaded most recent local fast block      number=1536 hash=ebcd68…10b559 td=3026
INFO [10-04|20:42:17] Loaded local transaction journal         transactions=0 dropped=0
INFO [10-04|20:42:17] Regenerated local transaction journal    transactions=0 accounts=0
INFO [10-04|20:42:17] Starting P2P networking
INFO [10-04|20:42:19] UDP listener up                          self=enode://d7cb73da3884d0cd600f173c9afb1ef19067b7179bfb0c99d734bedd5ae0bc579e9c6dfcef824a9cfee8a63096aa2bd85b17ed2c58213f9870a24c1d07959a46@[::]:30303
INFO [10-04|20:42:19] RLPx listener up                         self=enode://d7cb73da3884d0cd600f173c9afb1ef19067b7179bfb0c99d734bedd5ae0bc579e9c6dfcef824a9cfee8a63096aa2bd85b17ed2c58213f9870a24c1d07959a46@[::]:30303
INFO [10-04|20:42:19] IPC endpoint opened: /root/.ethereum/rinkeby/geth.ipc
Welcome to the Geth JavaScript console!

instance: Geth/v1.7.2-unstable/linux-amd64/go1.9
 modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

INFO [10-04|20:42:19] IPC endpoint closed: /root/.ethereum/rinkeby/geth.ipc
INFO [10-04|20:42:19] Blockchain manager stopped
INFO [10-04|20:42:19] Stopping Ethereum protocol
INFO [10-04|20:42:19] Ethereum protocol stopped
INFO [10-04|20:42:19] Transaction pool stopped
INFO [10-04|20:42:19] Database closed                          database=/root/.ethereum/rinkeby/geth/chaindata

The geth Docker image runs fine if I use -it instead of -d when starting the Docker container.

How should we get geth to work properly using -d?

  • 1
    Try removing console command, docker doesn't have a console without -it flag. – Ismael Oct 4 '17 at 21:13
  • 1
    @Ismael Without console command, am I still able to unlock an account when needed and with a timeout? – Nyxynyx Oct 4 '17 at 21:26
  • 2
    You should be able to attach to a running instance of geth something like docker exec -it <container> geth attach /root/.ethereum/rinkeby/geth.ipc. – Ismael Oct 4 '17 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.