How to spin up a node on Docker
Andzej Korkuz avatar
Written by Andzej Korkuz
Updated over a week ago

Docker on Windows and MacOS

Docker Desktop for Windows is Docker designed to run on Windows 10 and macOS. It is a native application that provides an easy-to-use development environment for building, shipping, and running dockerized apps. Docker Desktop for Windows uses Windows-native Hyper-V virtualization and networking and is the fastest and most reliable way to run Dockerized apps on Windows.

System Requirements

  • Windows 10 64-bit: Pro, Enterprise, or Education (Build 15063 or later).

  • Hyper-V and Containers Windows features must be enabled.

To check your Windows version, go to Command Prompt and type winver. Virtualization support feature can be checked under Task Manager > CPU Performance (this option should be enabled by default).

Known limitations:

  • Because of the way networking is implemented in Docker Desktop for Windows/Mac, you cannot see a docker0 interface on the host. This interface is actually within the virtual machine.

  • Docker Desktop for Windows/Mac can’t route traffic to Linux containers.

  • The docker (Linux) bridge network is not reachable from the Windows/Mac hosts.

    Installation

Download and install Docker Desktop executable for Windows/Mac.

When the installation finishes, Docker starts automatically. The "whale" icon in the notification area indicates that Docker is running, and accessible from a terminal. We now assume that Docker Desktop for Windows or Mac has been successfully installed and Docker Service is up and running.

Automatically update Docker container image with Watchtower

Watchtower works both with Docker’s run command and Docker Compose to automatically update a Docker image. Both methods are functionally the same in creating a container running Watchtower, then pointing it towards a container you wish to keep automatically updated. In our case, we will be monitoring Myst container only.

By default Watchtower polls your repository for image updates every 86400 seconds, or 24 hours. This interval can be changed with the --interval flag or WATCHTOWER_POLL_INTERVAL environment variable. It accepts a value in seconds. In the below example, we have increased it to 259200 seconds, or 72 hours time interval:

docker run -d --name watchtower -e WATCHTOWER_POLL_INTERVAL=259200 -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower myst

‍For WINDOWS users: Open a command-line terminal and type the following command:

docker pull mysteriumnetwork/myst && docker run --cap-add NET_ADMIN -d -p 4449:4449 --name myst -v myst-data:/var/lib/mysterium-node --restart unless-stopped mysteriumnetwork/myst:latest service --agreed-terms-and-conditions

Note 1: Replace myst-data with the path where you'd like to store the node's configuration and keystore files, e.g.

Note2: By adding --agreed-terms-and-conditions command line option you accept our Terms & Conditions.

For MacOS users: Open a command-line terminal and type the following command:

docker pull mysteriumnetwork/myst && docker run --cap-add NET_ADMIN -d -p 4449:4449 --name myst -v myst-data:/var/lib/mysterium-node --device /dev/net/tun:/dev/net/tun --restart unless-stopped mysteriumnetwork/myst:latest service --agreed-terms-and-conditions

Note 1: Replace myst-data with the path where you'd like to store the node's configuration and keystore files, e.g.

Note2: By adding --agreed-terms-and-conditions command line option you accept our Terms & Conditions.

Docker on Linux

Docker is a tool that enables developers to ship and run applications such as a Mysterium Node by the use of containers. A container holds all the required libraries, services and other application dependencies and ships it as a single package.

The advantage of docker is that it requires a lot less computing power when compared to virtual machines as it reuses the kernel of the operating system on the host machine and isolates the containerized application from global system settings and environmental factors. This makes it easy to run applications without worrying about the operating system compatibility issues, as well as collisions with other installed software or system configuration.

docker pull mysteriumnetwork/myst && docker run --cap-add NET_ADMIN -d -p 4449:4449 --name myst -v myst-data:/var/lib/mysterium-node --restart unless-stopped mysteriumnetwork/myst:latest service --agreed-terms-and-conditions

Note 1: Replace myst-data with the path where you'd like to store the node's configuration and keystore files, e.g.

Note2: By adding --agreed-terms-and-conditions command line option you accept our Terms & Conditions.

Note3: Use Docker detached mode by adding the option --detach or -d.

docker run -d IMAGE

It will run a Docker container in the background of your terminal. If you run containers in the background, you can find out their details using docker ps and then reattach your terminal to its input and output.

Make sure to use volumes as in the example above to persist your node's identity through container and host system restarts or node image upgrades.

If you want to keep your docker container up to date, you can use the following script to run as a daily cron job.

#!/usr/bin/env bash set -e BASE_IMAGE="myst:latest" REGISTRY="mysteriumnetwork" IMAGE="$REGISTRY/$BASE_IMAGE" HOSTMYSTDIR="/var/mystnode" #this can be changed to your liking - make sure the path exists and matches your current settings. OPTIONS="--net=host" #this can be changed to your needs. For example -p 4449:4449 ..... CID=$(docker ps | grep $IMAGE | awk '{print $1}') docker pull $IMAGE for im in $CID do LATEST=`docker inspect --format "{{.Id}}" $IMAGE` RUNNING=`docker inspect --format "{{.Image}}" $im` NAME=`docker inspect --format '{{.Name}}' $im | sed "s/\///g"` echo "Latest:" $LATEST echo "Running:" $RUNNING if [ "$RUNNING" != "$LATEST" ];then echo "upgrading $NAME" docker stop $NAME docker rm -f $NAME docker run -d --restart unless-stopped --cap-add NET_ADMIN $OPTIONS --name $NAME -v $HOSTMYSTDIR:/var/lib/mysterium-node mysteriumnetwork/myst:latest service --agreed-terms-and-conditions else echo "$NAME up to date" fi done

Complete installation

Once the container is running please log into the Node UI to set up your wallet address and claim your node in MMN.


Did this answer your question?