Dockerizing Decred - dcrd

2 minute read


1. Introduction

Decred blockchain server, dcrd, can be executed from a Docker VM.

If you are new to Docker, please read the docs to learn more. Below you can read an introduction to Docker from the official documentation:

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.

This article assumes the structure described in Scenario 4 explained in article dcrdata: running your own block explorer.

Figure 1 – Running Decred on Docker
Figure 1 – Running Decred on Docker

2. Configuring Docker files

Docker can be executed from your local computer/server or from a Cloud service like Amazon AWS or Microsoft Azure.

The following steps were performed on a macOS 10.15.6.

a) Install Docker Desktop from

b) This example assumes the following folder structure, with three files created in the same dcrd folder, child of a parent docked_decred folder.

|_ dcrd
   |_ Dockerfile

The first half of the Dockerfile tells Docker to download an Alpine Linux 3.12 image, create a storage volume named ‘dcrd_volume’, update the package list, install gnupg and tar, and then open TCP port 9108 (necessary if a dcrdata will connect to this dcrd, otherwise this line EXPOSE 9108/tcp can be removed).


FROM alpine:3.12

LABEL maintainer="Marcelo, from Decred" \

VOLUME dcrd_volume

RUN apk update
RUN apk add gnupg tar
EXPOSE 9108/tcp

RUN chmod +x
RUN chmod +x

CMD ["/opt/decred/dcrd", "--txindex", "--addrindex"]

The second half copies two scripts from the same folder where the Dockerfile resides (you will have to put all the files in the same folder) to the Docker image. The line RUN / tells Docker to run the following script after the download and the last line tells it to start dcrd with the flags “–txindex” and “–addrindex”, used by dcrdata, as soon as the script execution is finished.



gpg --keyserver ${PGP_SERVER} --recv-keys ${DECRED_PGP_KEY_FP}
GPG_SIG=$(gpg --with-colons --status-fd 1 --verify ${DECRED_MANIFEST_ASC} 2> /dev/null)
SHASUM_SIG=$(sha256sum -c ${DECRED_MANIFEST} | grep -c "OK")

if [[ `echo $GPG_SIG | grep -c GOOD` -eq 1 && $SHASUM_SIG -eq 1 ]]; then
    tar -xzf ${DECRED_PKG}
    mv ${DECRED_DIR} /opt
    ln -s /opt/${DECRED_DIR} /opt/decred
fi is a one-liner script to facilitate reading the status.

No big deal here. This script just simplifies tapping into dcrd log file instead of writing its full path.

tail -f /home/.dcrd/logs/mainnet/dcrd.log

3. Running a Dockerized dcrd

On your host, type the following command to start Docker dcrd VM:

$ docker -

Execute logview_dcrd script the check if dcrd is downloading the blockchain:

$ ./

4. Next steps

Now that we have a running dcrd on Docker, the next part will deal with dcrdata and PostgreSQL to dockerize the block explorer.