I created a Geth node using the default Docker container, but realized I need to make some adjustments to the docker run command, which requires removing the current container. How do I backup my current account information so that isn't lost when removing the container?

1 Answer 1


Ethereum accounts are saved in the $HOME/.ethereum/keystore folder. Since the Docker container is set to run geth as root, that translates to /root/.ethereum/keystore

Using the docker cp command we can get that file out of a running container:

docker cp CONTAINERNAME:/root/.ethereum/keystore keystore

Replace CONTAINERNAME with the name of your running geth container.

If you wish to keep an account long-term, and save the chain data already synced from your Docker container, set up the /root/.ethereum/ folder as a data volume for the Docker container when you start it up:

docker volume create --name geth-data
docker run -d -v geth-data:/root/.ethereum --name geth ethereum/client-go

That will create a volume named geth-data that will persist even if the ethereum/client-go container is destroyed. To get data out of that volume you can spin up a simple container and then copy the data out:

docker run -v geth-data:/data --name geth-backup ubuntu:wily
docker cp geth-backup:/data ethereum-data

With that docker cp command you can copy the contents out where you want. Or, the one-liner:

docker run --rm -v geth-data:/data -v $(pwd):/backup ubuntu:wily tar cvf /backup/ethereum-data.tar /data

That will place an ethereum-data.tar archive in the folder you run it on. The ubuntu:wily container is used as a simple container because that's the base container used by the ethereum/client-go container, so if you've been running ethereum/client-go containers, you already have that one downloaded.

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.