Published 28 August 2019

Credits software in a Docker container 

 

In this article is presented a general procedure for installing Credits software in a Docker container. Credits software package provides all, the configuration files and the main modules: desktop wallet, contract-executor module for executing smart contracts, and the node daemon (client). 

Docker is an application that simplifies managing application processes in containers. Containers let users run applications in resource-isolated processes. They are similar to virtual machines, but containers are more portable, more resource-friendly, and more dependent on the host operating system. In addition, Portainer is the most popular web interface for working with Docker. It consists of a web UI that allows easily manage Docker containers, images, networks and volumes.

Docker installation

Docker installation

Docker Installation process on Windows, Linux and other operating systems (OS) can be performed according to the instructions on Docker official website. 

Figure 1. Docker installation.

Installation on Linux OS can be performed by following different methods according to Docker documentation

 

Portainer installation using Docker

Due to the nature of Docker, there are several deployment scenarios, however, below is detailed the most common for Windows and Linux OS.

Windows:

$ docker volume create portainer_data

$ docker run -d -p 9000:9000 --name portainer --restart always -v \\.\pipe\docker_engine:\\.\pipe\docker_engine -v portainer_data:C:\data portainer/portainer

Linux:

$ docker volume create portainer_data

$ docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

Figure 2. Portainer installation.

 

Create a new Docker container

Create a new Docker container 

First at all, a new container should be created.  An image can be selected to download and used to create a Docker container. There are several images available on the central repository and all can be downloaded through the docker command:

$ docker search ubuntu

A basic ubuntu image can be download by writing the following command:

$ docker pull ubuntu:18.04

The downloaded image can be checked by typing the command written below. See figure 3.

$ docker images

 

Figure 3. Container image.

The next step is to create a container and make the required changes. Creating a container can be done with the ‘run’ command followed by several options and arguments. Besides, the container ID and other useful information can be obtained with the command: docker ps -a. 

$ docker run -i -t <image ID>  /bin/bash

Then the created container can be started by Docker command prompt. Is possible to use the container name or the container ID. See the example below:

$ docker start -ai lucid_goldberg 

$ docker exec -it 2b2f074497d9 /bin/bash

 

The proper Java version must be installed in the container by using the commands below. 

$ docker exec -it <container ID> apt-get install openjdk-11-jre

$ docker exec -it <container ID> apt-get install openjdk-11-jdk

After that, the Java version (11 or 12) can be checked by typing the command: 

$ docker exec -it <container ID> java -version

$ docker exec -it 2b2f074497d9 java -version

Figure 4. Java installation.

Credits software installation

Credits software installation 

Download Credits software (SW) components and if is needed install (wget) also in the container. 

$ docker exec -it <container ID> apt install wget

$ docker exec -it <container ID> wget https://credits.com/Content/file_users/Credits_Network_for_Linux_x64_4_2_410.tar.gz

Figure 5. Download Credits software.

After downloading Credits SW, files should be unzipped by using the command: 

$ docker exec -it <container ID> tar -xzvf Credits_Network_for_Linux_x64_4_2_410.tar.gz

Figure 6. Unzip files in a directory.

Another alternative method is to copy main Credits software components  from host to Docker container in a credits folder: daemon client, config.ini, contract-executor module and settings properties file. Below an example is provided:

$ docker cp config.ini <container ID>:/home/

$ docker cp config.ini 2b2f074497d9:/home/

Afterward, in the container shell, change to directory: ‘credits’ by using command ‘cd’. In this directory should be located the main Credits components. The configuration file: ‘config.ini’ where the user can specify the signal server IP address, the ports and other parameters in order to establish connection with Credits blockchain.

Figure 7.  Main components in credits directory.

Then in the ‘credits’ directory the node daemon: ‘client’ should start by using the command:

./client

Figure 8. The node start.

After launching the node, the user can generate the encryption keys by typing ‘g’, or could quit by writing ‘q’. If the option for generating the keys is selected, he might choose a encryption type by selecting the option 1. Afterward, will be presented the options ‘p’ and ‘f’ in order to use the password or a file. Then, the node will try to connect to the Credits blockchain first time. See figure 9.

Figure 9. Connection established with signal server.

Once the password is confirmed, the node will establish connection with the signal server in Credits network. 

 

Votes 0, average rating 0

Contents