Author new Nomad v1.11.2 HCL job specs, review and validate existing specs, and convert Docker Compose files to Nomad HCL — service, batch, and periodic/cron jobs using the docker task driver only
Apply these rules whenever authoring, reviewing, or converting Nomad job specifications.
docker only. Never use exec, raw_exec, java, or any other driver.service and batch only, including periodic variants. Do not generate system or sysbatch jobs unless the user explicitly requests it.When asked to create a new Nomad job spec:
job, datacenters, type.service jobs: include at minimum one with a , a stanza, and a stanza with a health check.grouptasknetworkservicebatch jobs: set type = "batch". Include a restart stanza with attempts = 0 and mode = "fail" unless the user specifies otherwise.periodic stanza with cron, prohibit_overlap = true, and time_zone = "UTC" unless the user specifies a timezone. Set the job type to "batch" for periodic batch jobs.cpu, memory in the resources stanza. Never rely on defaults.docker driver, always include:
image in configforce_pull = true unless the user specifies otherwiseauth block if the image is from a private registry (prompt the user for credentials handling strategy)template stanzas with env = true for environment variable injection from Consul or Vault where appropriate.# ... rest of config.When asked to review or validate an existing HCL job spec:
force_pull = false on docker tasks without a pinned digest, missing restart or reschedule policies.datacenters wildcards, missing update stanza on service jobs, missing vault or template stanzas where secrets appear hardcoded in env.error (will fail validation or cause runtime failure), warning (risky but valid), or suggestion (improvement only)job > group "web" > task "app" > config)X error(s), Y warning(s), Z suggestion(s).nomad job validate <file> before deploying.When asked to convert a docker-compose.yml to Nomad HCL:
Map each top-level services entry to a separate Nomad group within a single job, unless the user requests separate job files per service.
Apply these mappings:
| Docker Compose field | Nomad HCL equivalent |
|---|---|
image | config { image = "..." } |
ports | network { port "label" { to = <container_port> } } + service { port = "label" } |
environment | env { ... } block on the task |
volumes (host-bind) | config { volumes = ["host:container"] } |
command / entrypoint | config { command = "..." args = [...] } |
labels | meta { ... } on the group |
restart: always | restart { attempts = 10 mode = "delay" } |
restart: no | restart { attempts = 0 mode = "fail" } |
healthcheck | service { check { ... } } stanza |
mem_limit | resources { memory = <MiB> } |
cpus | resources { cpu = <MHz> } (note: Nomad uses MHz, not fractional CPUs — state the assumed MHz value and ask the user to confirm) |
For any Docker Compose key not in the table above and not mappable to Nomad HCL, explicitly list it in an Unmapped fields section at the end of the output:
Always output the complete converted HCL. Never truncate.
Remind the user to run nomad job validate <file> on the output before deploying.