Skip to content

Nomad

Nomad is a simple and flexible scheduler and workload orchestrator to deploy and manage containers and non-containerized applications across on-prem and clouds at scale.

Quick Start

Start dev environment

  1. Start Docker Desktop
  2. Start Nomad

    nomad agent -dev -bind 0.0.0.0 -network-interface=en0
    
  3. If you get IPv6 issues on macOS check MacOS Docker Desktop Tricks

For more information, see Dev Environment

Deploy a job

  1. Create a redis.nomad.hcl file with the following contents

    redis.nomad.hcl
    job "redis" {
      group "redis" {
        network {
          port "redis" {
            static = 6379
            to     = 6379
          }
        }
    
        task "redis" {
          driver = "docker"
          config {
            image = "redis:alpine"
            ports = ["redis"]
          }
        }
      }
    }
    
  2. Deploy it via the CLI

    nomad job run redis.nomad.hcl
    

For more information, see Jobs

Pages

CLI Commands

Run a Job

nomad job run job.nomad

Open Web UI

nomad ui

Directories

  • Config File (Fedora): /etc/nomad.d/nomad.hcl
  • Data Directory (Fedora): /opt/nomad/data

Tips

Docker images failing to pull due to timeouts

Permission denied after mounting host volume into Docker container

Set the user to root

task "prometheus" {
  driver = "docker"
  user = "root"

  config {
    image = "prom/prometheus:latest"
  }
}

Debugging failed allocations

Set the entrypoint to prevent the container from crashing so it can be exec’d into

task "grafana" {
  driver = "docker"
  config {
    image = "grafana/grafana-oss:latest"
    ports = ["grafana-ui"]

    entrypoint = ["/bin/sh", "-c", "while true; do sleep 500; done"]
  }
}

Debugging Environment Variables

Exec into a container a run printenv or env

Extending the Garbage Collection threshold for a Job

By default old Jobs are removed after 4 hours, after that time passes all data related to the Job is removed (including logs).

It can be useful to increase this, for example to see logs of failed Jobs in the UI.


Last update: August 12, 2023
Created: June 3, 2023