Published 28 November 2018

Using Credits blockchain software in Docker



The purpose of this article is to demonstrate the use of Docker and Credits software. Credits software consists of configuration files and the three modules: Desktop Wallet app (user wallet), contract-executor (execution of smart contracts), and node module.

In the Docker container we will use Desktop Wallet app and contract-executor.



Docker is software for automating deployment and application management in a virtualization environment at the operating system level. Allows you to "package" the application with all its environment and dependencies in a container that can be ported to any Linux system, as well as providing a container management environment.

Portainer is the most popular web interface for working with Docker hosts and Docker Swarm clusters. Is launched by deploying a Docker image that is passed address/socket of the Docker host as a parameter. Allows you to manage containers, images (can pick them up from Docker Hub), networks, volumes.

Installing components

Installing components


Installation in Windows. Download page.

Installation on Linux is done using the Advanced Packaging Tool (apt). Installation commands:

sudo apt-get update

sudo apt-get install \
   apt-transport-https \
   ca-certificates \
   curl \

curl -fsSL | sudo apt-key add -

sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository \
  "deb [arch=amd64] \
  $(lsb_release -cs) \

sudo apt-get update

sudo apt-get install docker-ce


The installation is the same on both operating systems, except on Linux you must add the sudo command:


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


sudo docker volume create portainer_data
sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer



To run Desktop Wallet app and contract-executor in a container simultaneously, we will use a simple program in C++, code, let's call the file runner.cpp:

Build command:

g++ -pthread runner.cpp  -o runner

the build must be done on a computer with Linux operating system.

Creating a Dockerfile script file and image

Creating a Dockerfile script file and image

FROM ubuntu:18.04

# update && java 8 install

RUN apt-get update && \

apt-get upgrade -y && \

apt-get install -y software-properties-common && \

add-apt-repository ppa:webupd8team/java -y && \

apt-get update && \

echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \

apt-get install -y oracle-java8-installer && \

apt-get clean

# setup worker dir

WORKDIR /Credits

# copy all files from current dir to ./Credits

COPY . /Credits

# ports



# run

CMD ["./runner"]

The directory containing the Dockerfile file needs to be placed to the unzipped Credits software archive. In the case of an image build in Linux OS files ./client and ./runner must be marked as runned:

chmod +x client

chmod +x runner

Image build command: docker build -t Credits .

Starting the container from the created image

Starting the container from the created image

Note: When starting from Linux, you must add the sudo command.

Use the following command to create a container from the collected image:

docker volume create test_db - create the volume, where the database will be stored

docker run -it -p 6000:6000 -p 9090:9090 --mount source=db,target=/Credits/test_db Credits:latest bash

starting from container

Check the success of the launch - ./runner command:

at the initial start you will be prompted to generate a new key.

The figure shows that it is running the client (node) and contract-executor in container.

Now you can run only user Desktop Wallet app on the host machine.

Note: container can be run remotely anywhere, for example, in Azure.

Votes 0, average rating 0