0

I'm creating a Docker private blockcain from here:

https://medium.com/scb-digital/running-a-private-ethereum-blockchain-using-docker-589c8e6a4fe8

But I'm afraid to lost all my data if I need to delete/deploy the container again.

Is there any way to create an external volume to save the chain data?

Magno C
  • 345
  • 1
  • 5
  • 18
  • Sorry guys... I think I've found the answer here: https://ethereum.stackexchange.com/questions/1724/possible-to-store-the-blockchain-in-a-different-directory ... so I need to create a volume pointing to <DATA_DIR>/geth/ – Magno C Aug 11 '23 at 00:53
  • Not too fast!! <DATA_DIR>/geth/ is already filled with the genesis data and if I mount a volume there it will be overriden. I think this is more like a Docker question. – Magno C Aug 11 '23 at 00:56

1 Answers1

0

This is my solution so far:

Create a volume:

docker volume create masternode_data

Assign it to the node:

docker run --name=bc-masternode --hostname=bc-masternode \
--network=internal \
-p 30303:30303 \
-v masternode_data:/datadir \
...

Check the content:

docker run --rm -it -v masternode_data:/datadir busybox /bin/sh

Just keep in mind that this is a shared data. Don't mess anything...

Magno C
  • 345
  • 1
  • 5
  • 18