Welcome to the Ethereum Stack Exchange.
The following should enable you to connect to the Geth console through the Docker container. There may be other ways of accomplishing the same thing.
- Find the name of the container running Geth
The following command will list all running Docker containers:
make note of the name and/or id
- Connect to the container
docker exec -it <NAME OR ID> bash
This should put the terminal "in" the Docker container.
(Note: if this command gives you a
no such file or directory: unknown. error, try replacing
ash. It depends on which shell is installed in the container by default. (Source)
- Create an account
Your reference to
personal.newAccount() seems to be a reference to the Geth console. You'll need to find the
.ipc file Geth creates while running and connect to it. You may already know where it is. If you don't, you should be able to use:
find / -name "geth.ipc"
make note of the path
- Open the Geth Console
geth attach path/to/geth.ipc
(Please note that this answer assumes that you want to use the Geth console, and not
Note: While researching the answer to this question, I came across something that might be useful for you. Running these commands as is will not save the data between sessions. That means that if you are syncing a public network (testnet or mainnet), that you'll need to restart syncing from the beginning every time you launch the container. If you'd like to save the sync data to disk, then when you run
docker run, you should add the
-v flag along with the path you want the data saved in, like this:
docker run -it -p 30303:30303 -v /path/on/host:/root/.ethereum ethereum/client-go
/path/on/host is the directory the data should be saved in. (Source)