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 block. Alternatively, you can keep reading to see a few examples.
Nomad HCL is parsed in the command line and sent to Nomad in JSON format via the HTTP API.
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 the same Nomad client.
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
block can also be specified at the group level. This
allows job specification authors to create and register services with Consul Connect support. A service
block specified at the group level must include a connect block, like the following snippet.