Job Specification
The Nomad job specification (or "jobspec" for short) defines the schema for Nomad jobs. Nomad jobs are specified in HCL, which aims to strike a balance between human readable and editable, and machine-friendly.
The job specification is broken down into smaller pieces, which you will find expanded in the navigation menu. We recommend getting started at the job stanza. Alternatively, you can keep reading to see a few examples.
For machine-friendliness, Nomad can also read JSON-equivalent configurations. In general, we recommend using the HCL syntax.
The general hierarchy for a job is:
Each job file has only a single job, however a job may have multiple groups, and each group may have multiple tasks. Groups contain a set of tasks that are co-located on a machine.
Example
This example shows a sample job file. We tried to keep it as simple as possible, while still showcasing the power of Nomad. For a more detailed explanation of any of these fields, please use the navigation to dive deeper.
Note that starting with Nomad 0.10, the service
stanza can also be specified at the group level. This
allows job specification authors to create and register services with Consul Connect support. A service
stanza specified at the group level must include a connect stanza, like the following snippet.