Tutorials · DevOps & Containers
How to Deploy Edge Applications With Docker Compose
Describe every container, port, volume and setting of a site in one file, keep it in Git, and deploy the same stack to every NavEdge edge server.
Before you start
- Docker Engine with the compose plugin
- A Git repository for your site configuration
Step by step
Write the compose file
One service per container, pinned versions, restart policies, volumes for data and a health check.
# compose.yaml services: app: image: ghcr.io/example/site-app:2.4.1 restart: unless-stopped env_file: .env ports: ["8080:8080"] volumes: [appdata:/data] healthcheck: test: ["CMD", "wget", "-qO-", "http://localhost:8080/health"] interval: 30s db: image: postgres:16-alpine restart: unless-stopped environment: POSTGRES_PASSWORD_FILE: /run/secrets/dbpw secrets: [dbpw] volumes: [dbdata:/var/lib/postgresql/data] secrets: dbpw: { file: ./secrets/dbpw.txt } volumes: { appdata: {}, dbdata: {} }
Keep secrets out of Git
Put passwords in .env or secret files that are listed in .gitignore and copied to the edge server separately.
Validate and start
compose config shows the final file with variables filled in; up -d starts or updates the stack.
docker compose config --quiet && docker compose up -d docker compose ps
Update one service
Change the version in the file, commit, then pull and recreate only what changed.
docker compose pull app && docker compose up -d appRoll back
If the new version fails its health check, check out the previous commit and run up -d again.
Logs
Follow one service, or all of them during a change.
docker compose logs -f --tail 100 app
Commands are generic, industry-standard examples. Exact syntax and menu names vary by model and firmware; check your device's manual on the Documentation page.
Pro tips
- Use the same compose file on every site and keep site differences in .env files.
- Set log rotation in /etc/docker/daemon.json so logs cannot fill the disk.
FAQ
Frequently asked questions
Do I need Kubernetes?
Not for one to a few edge servers per site. Compose plus Git is simpler to run and troubleshoot; consider an orchestrator when you manage many nodes per site.
Keep learning
Related guides
Docker basics on NavEdge
Read more →Configuration as code with Git
Read more →How to Use SSH Keys Instead of Passwords for Network Devices and Servers
Passwords can be guessed, phished and reused. Create an SSH key pair, install the public key on gateways, edge servers and Linux hosts, then turn password logins off.
Read more →How to Reach Remote Sites Safely With an SSH Jump Host
Do not expose SSH on every device. Put one hardened jump host (bastion) in front of the management network and reach everything else through it.
Read more →How to Open a Device Web Page Through an SSH Tunnel
Reach the web interface of a switch, NVR or container on a remote site without opening a firewall port: forward it through SSH.
Read more →Stuck on a step?
Ask Navijin technical support or an authorised partner for help with your configuration.