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.

Intermediate15 min6 steps

Before you start

  • Docker Engine with the compose plugin
  • A Git repository for your site configuration

Step by step

  1. 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: {} }
    
  2. Keep secrets out of Git

    Put passwords in .env or secret files that are listed in .gitignore and copied to the edge server separately.

  3. 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
    
  4. 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 app
    
  5. Roll back

    If the new version fails its health check, check out the previous commit and run up -d again.

  6. 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.