Private Blockchain with Docker and Ethereum

Index

References

'Blockchain For Dummies' by Tiana Laurence. Published by John Wiley & Sons, 2017.

Download Docker Toolbox

Go to [https://www.docker.com/products/docker-toolbox] and download it.

Install Docker Toolbox

Perform default installation of the Docker Toolbox.

Download GitHub Desktop

Go to [https://desktop.github.com/] and download it.

Install and sign into GitHub.com

Sign up if you do not already have an account.

Create a directory to store blockchain data

Create a directory named 'ethereum' in your computer to store your blockchain data. It will be used to hold your future repository and other files.

E.g: J:\IBERMATICA\SELFTRAINING\wss\ws-ethereum\

Clone from GitHub information needed for building a new blockchain

Use 'GitHub Desktop' to clone "Capgemini-AIE/ethereum-docker" into the previously created local directory:

GitHub Desktop capture

Building your blockchain

(1) Open "Docker Quick Start Terminal"

The previously installed 'Docker Quick Start Terminal' launches Docker in your computer.

(optional) Configuring network proxy

If you network requires using a proxy, you'll get an error similar to the following:

'Error with pre-create check: "Get https://api.github.com/repos/boot2docker/boot2docker/releases/latest: dial tcp 192.30.253.116:443: connectex: Se produjo un error durante el intento de conexión ya que la parte conectada no respondió adecuadamente tras un periodo de tiempo, o bien se produjo un error en la conexión establecida ya que el host conectado no ha podido responder."

Looks like something went wrong in step ´Checking if machine default exists´...'

The solution is:

Note that this specific example was using Windows 7 with an CNTLM proxy installed on localhost and available on default port 3128 and configured in gateway mode (using the host IP address for the VirtualMachine to also be able to use it).

Setting proxy environment variables to be picked up by the Docker Quickstart Terminal. HTTP_PROXY, HTTPS_PROXY and NO_PROXY:

>set
...
HTTPS_PROXY=http://172.23.220.6:3128/
HTTP_PROXY=http://172.23.220.6:3128/
NO_PROXY=192.*.*.*,home.com,*.aventail.com,.seanet.com
...

(optional) Enabling BIOS VT-X/AMD-v

If your machine does not have BIOS VT-X/AMD-v enabled, you'll get an error similar to the following:

Error creating machine: Error in driver during machine creation: This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory

Looks like something went wrong in step ´Checking if machine default exists´... Press any key to continue...

The solution is:

Configuring your computer BIOS with virtualization enabled

(2) Change to the 'ethereum' directory

In the terminal opened by the Docker application, change to the directory you made in the preceding section.

cd /d/IBERMATICA/SELFTRAINING/wss/ws-ethereum/ethereum-docker

(3) Create one standalone Ethereum node

Create one standalone Ethereum node by entering the following command into your terminal:

docker-compose -f docker-compose-standalone.yml up -d

This line has created the following:

One Ethereum bootstrapped container

One Ethereum container that connects to the bootstrapped container

One Netstats container with a web UI to view activity in the cluster

(optional) Fixing connection refused error

If you get a connection refused error:

Creating network "ethereumdocker_default" with the default driver
Pulling geth (ethereum/client-go:latest)...
ERROR: Get https://registry-1.docker.io/v2/: proxyconnect tcp: dial tcp 127.0.0.1:3128: getsockopt: connection refused

Then issue might be that the VirtualBox machine cannot connect to your local machine CNTLM proxy. It can be solved reconfiguring CNTLM in gateway mode:

https://forums.docker.com/t/beginner-having-trouble-with-docker-behind-company-proxy/3968/4

(4) Access the newly created blockchain

From your browser access:
http://$(docker-machine ip default):3000
E.g:
http://192.168.99.101:3000

WARNING: THIS STEP DIDN'T WORK FOR ME (NO SERVICE IS RESPONDING IN PORT 3000), UNABLE TO FOLLOW THE INSTRUCTIONS IN BOOK 'Blockchain For Dummies'.