kasnodes

kaspad in Docker

Intermediate8 stepsAbout 15–30 minutes
1. Install Docker0 of 8 done
  1. Install Docker
  2. Write the compose file
  3. Know where the data lives
  4. Start the node
  5. Check it is syncing
  6. Make it public
  7. Day-to-day commands
  8. Troubleshooting

Before you start

1

Install Docker

Skip this if docker --version already prints a version.

On Ubuntu or Debian, Docker's install script adds its repository and installs Docker Engine. Other distributions are covered in Docker's install docs.

sudo apt update
sudo apt install -y ca-certificates curl
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USER

Sign out and back in, then confirm:

docker --version
docker compose version
Docker is ready when
  • docker --version prints a version
  • docker compose version works
  • docker ps runs without an error
2

Write the compose file

One short file describes the node: which image, which ports, where the data lives.

mkdir -p ~/kaspad-docker
cd ~/kaspad-docker

Save this in that folder as docker-compose.yml:

docker-compose.yml
services:
  kaspad:
    image: kaspanet/rusty-kaspad:latest
    container_name: kaspad
    restart: unless-stopped
    ports:
      - "16111:16111"            # P2P, needed for a public node
      - "127.0.0.1:16110:16110"  # RPC, from this machine only
    volumes:
      - kaspad-data:/app/data
    command:
      - kaspad
      - --yes
      - --nologfiles
      - --disable-upnp
      - --utxoindex
      - --rpclisten=0.0.0.0:16110
    logging:
      options:
        max-size: "50m"
        max-file: "3"

volumes:
  kaspad-data:
restart
Brings the node back after a crash or a reboot
ports
16111 for other nodes; 16110 for RPC, from this machine only
volumes
Chain data that outlives the container
command
Runs kaspad with the index wallets need
logging
Keeps the log to 150 MB
3

Know where the data lives

The chain is stored in a Docker volume, separate from the container, so upgrades never touch it.

docker volume ls
docker volume inspect kaspad-docker_kaspad-data

Don't delete the volume. Removing kaspad-data throws away the whole chain and the node has to sync again from nothing.

4

Start the node

The first run downloads the image and creates the volume.

cd ~/kaspad-docker
docker compose up -d
docker compose ps
It is running when
  • docker compose ps shows kaspad as Up
  • Ports 16110 and 16111 are listed
5

Check it is syncing

The first sync takes one to two hours on a machine that meets the requirements, longer on slower ones. Follow the log; press Ctrl+C to stop following.

docker compose logs -f kaspad
It is working when
  • Peers connect, 8 or more
  • Headers and blocks are being downloaded
  • No error repeats in the log
6

Make it public

Optional, and the most useful thing you can do: a public node helps new nodes join and sync.

  1. Find the local address of the machine running Docker.
  2. Open your router's admin page, usually at 192.168.1.1.
  3. Forward external TCP port 16111 to that machine, port 16111.

The container doesn't ask the router to open the port, so forward it by hand. On a Linux host with a firewall, open the port there too:

sudo ufw allow 16111/tcp

Router menus differ. portforward.com has steps for most models.

It is public when
  • The log shows inbound peers
  • The peer count climbs past 20
  • It appears on KasNodes after the next crawl
7

Day-to-day commands

Everything you'll need once it is running.

Stop
docker compose stop
Start
docker compose start
Restart
docker compose restart
Update to the newest version
docker compose pull
docker compose up -d
Which version is running
docker compose exec kaspad printenv RUSTY_VERSION
Resource use
docker stats kaspad
8

Troubleshooting

The usual problems and what fixes them.

The container keeps restarting

Read the last lines of the log with docker compose logs --tail=100 kaspad. Most often the disk is full or the machine has run out of memory. On Docker Desktop, check the memory and disk limits in Settings, Resources.

No peers connect

Check that the machine has a working connection and that nothing blocks outbound traffic. Give it a few minutes after starting.

Updating didn't change the version

docker compose pull fetches the newest image, and docker compose up -d restarts kaspad on it. Network upgrades need a new version, so update when Kaspa announces one.

It doesn't show as public

Confirm the router forwards TCP 16111 to the right machine and that a host firewall isn't blocking it. Some providers don't allow inbound connections at all.

The disk is filling up

Keep at least 640 GB free for the chain, 1 TB is better. On Docker Desktop, raise the virtual disk limit in Settings, Resources.

Running? Put your name on it.

Once the node shows up in a crawl you can claim it, pick a public name and follow its rank.