Docker Deployment

This guide covers deploying NCN Network v2 using Docker and Docker Compose.


Prerequisites

  • Docker 20.10+

  • Docker Compose 2.0+

  • 8 GB RAM minimum

  • 20 GB disk space

Verify Installation

docker --version
# Docker version 20.10.x or higher

docker compose version
# Docker Compose version 2.x.x

Quick Start

Start All Services

Services Started:

  • ncn-p2p-registry - P2P Registry on port 50050, 8828

  • ncn-gateway - Gateway on ports 50051, 8080, 9000

  • ncn-compute-node - Compute Node

Stop Services


Docker Compose Configuration

docker-compose.yml


Configuration

Environment Variables

Create a .env file in the project root:

Using Environment File


Building Images

Build All Images

Build Individual Images

Build Arguments


Scaling

Scale Compute Nodes

Using Docker Swarm


Volumes and Persistence

Data Volumes

Volume
Purpose
Location

p2p-data

Registry state

/data

gateway-data

Gateway state

/data

compute-models

AI models

/models

Mount Models Directory

Backup Data


Networking

Default Network

Docker Compose creates a bridge network:

  • Subnet: 172.20.0.0/16

  • Services communicate via service names

Port Mapping

Service
Internal
External

P2P Registry gRPC

50050

50050

P2P Registry P2P

8828

8828

Gateway gRPC

50051

50051

Gateway HTTP

8080

8080

Gateway WebSocket

9000

9000

Custom Network


Health Checks

Built-in Health Checks

Manual Health Check


Logging

View Logs

Log Configuration

Ship Logs to External Service


Resource Limits

Set Resource Constraints


GPU Support

Enable GPU Access

Verify GPU


Monitoring

Add Prometheus Metrics

Prometheus Configuration


Troubleshooting

Container Won't Start

Network Issues

Permission Issues


Production Checklist


Next Steps

Last updated