Https://github.com/ethereum/go-ethereum/wiki/Running-in-Docker
installation
If you rely on core version support to execute commands directly, you can download and install Docker.
Execute the following command, and the installation succeeds if a specific version is present.
Start
Service Docker start
viewing mirrors
Use the following command to view mirrors that have been installed locally.
Docker images
The above simple introduction of the installation of Docker, different versions may encounter different problems, we search for solutions. The following will mainly introduce the installation and use of Ethereum under Docker.
ethereum Docker Environment installation
Preferred, the Ethernet square client is recommended to use Docker to start the service.
Pull Mirroring
Install the Ethernet square client mirroring, simply execute a simple command:
Docker Pull Ethereum/client-go
After the installation is complete, execute the command to verify that the installation was successful, and if you see a ethereum/client-go in the list, the installation is successful:
Docker images
Start Node
Start a node
Docker Run-it-p 30303:30303 Ethereum/client-go
This allows a node to start successfully. You may encounter a problem with this link. Docker is not responsible for the management of network firewall policy configuration, my side for the extranet can access to, carried out a specific firewall policy configuration.
The following is my firewall policy for the Docker configuration, for reference only. Different configuration items are added under the corresponding policy.
*nat
:P rerouting ACCEPT [27:11935]
: INPUT ACCEPT [0:0]
: OUTPUT ACCEPT [598:57368]
:P ostrouting ACCEPT [591:57092]
:D Ocker-[0:0]
-a prerouting-m addrtype--dst-type local-j Docker
-a OUTPUT!-D 127.0.0.0/8-M addrtype--dst-ty PE local-j Docker
-A postrouting-s 192.168.0.0/16!-o docker0-j Masquerade
COMMIT
*filter
: INPUT acce PT [139291:461018923]
: FORWARD ACCEPT [0:0]
: OUTPUT ACCEPT [127386:5251162]
:D ocker-[0:0]-a
Forward-o docker0-j Docker
-a forward-o docker0-m conntrack--ctstate related,established-j ACCEPT
-a FORWA Rd-i Docker0! -O docker0-j ACCEPT
-A forward-i docker0-o docker0-j ACCEPT
COMMIT
The above has started a node normally, this node is a full node connecting the real network. If you want to invoke the corresponding API through the RPC interface, you also need to add the corresponding configuration parameter in the startup parameter:
Docker run-it-p 8545:8545-p 30303:30303 ethereum/client-go--rpc--rpcaddr "0.0.0.0"
The "0.0.0.0" parameter receives requests sent by all hosts on the 8545 interface, and the public network is cautious.
If you want to interoperate using the javascript** console, you can start the node using the following command:
Docker run-it-p 30303:30303 ethereum/client-go Console
Specify block chain data storage location
We all know that the Ethernet block chain data has reached dozens of G, if the disk is not enough Docker installed disk space, it is not trouble. When I use it, I reload a disk to store block data specifically. By using the command, you can specify the block data storage location at startup.
Docker run-it-p 30303:30303-v/path/on/host:/root/.ethereum ethereum/client-go
Where the-v parameter is used to specify the storage path. The basic function of this command is to mount the/root/.ethereum under the local path/path/on/host. Thus, when the container is started, the actual storage of the file is in the/path/on/host directory.