Files
nomad/website/content/docs/commands/job/init.mdx
Aimee Ukasick 23fd87d9c9 Docs: Commands section move "General options" to page bottom (#26001)
* sectionless files plus acl section

* alloc section

* config, deployment sections

* job section

* licence, namespace

* node, node-pool

* operator

* plugin, quota, recommendation

* scaling, sentinel, server, service, system, var, volume

* Add "ENT" label to left nav for enterprise commands

* job tag break into separate folder and files; update options header
2025-06-12 14:31:38 -05:00

46 lines
1.6 KiB
Plaintext

---
layout: docs
page_title: 'nomad job init command reference'
description: |
The `nomad job init` command generates a job specification with example configurations for tasks, task groups, runtime constraints, and resource allocation.
---
# `nomad job init` command reference
**Alias: `nomad init`**
The `job init` command creates an example [job specification][jobspec] in the
current directory that demonstrates some common configurations for tasks, task
groups, runtime constraints, and resource allocation.
## Usage
```plaintext
nomad job init [options] [filename]
```
You may optionally supply a filename for the example job to be written to. The
default filename for the generated file is "example.nomad.hcl".
Please refer to the [jobspec] and [drivers] pages to learn how to customize the
template.
## Options
- `-short`: If set, a minimal jobspec without comments is emitted.
- `-connect`: If set, the jobspec includes Consul Connect integration.
- `-template=<template>`: Specifies a predefined template to emit. Must be a Nomad Variable that lives at `nomad/job-templates/<template>` These are commonly created via the UI, and accessible with the -list-templates flag.
- `-list-templates`: Display a list of possible job templates to pass to -template. Reads from all variables pathed at `nomad/job-templates/<template>`.
## Examples
Generate an example job file:
```shell-session
$ nomad job init
Example job file written to example.nomad.hcl
```
[jobspec]: /nomad/docs/job-specification 'Nomad Job Specification'
[drivers]: /nomad/docs/drivers 'Nomad Task Drivers documentation'