2016-10-28 00:36:26 +00:00
---
2020-02-06 23:45:31 +00:00
layout: docs
page_title: 'Commands: job init'
description: |
2018-03-22 17:56:06 +00:00
The job init command is used to generate a skeleton jobspec template.
2016-10-28 00:36:26 +00:00
---
2018-03-22 17:56:06 +00:00
# Command: job init
2019-10-22 13:44:00 +00:00
2018-03-22 18:09:26 +00:00
**Alias: `nomad init`**
2016-10-28 00:36:26 +00:00
2018-03-22 17:56:06 +00:00
The `job init` command creates an example [job specification][jobspec] in the
2016-10-28 00:36:26 +00:00
current directory that demonstrates some common configurations for tasks, task
groups, runtime constraints, and resource allocation.
2019-10-22 13:44:00 +00:00
## Usage
```plaintext
2019-12-19 19:59:12 +00:00
nomad job init [options] [filename]
2019-10-22 13:44:00 +00:00
```
2016-10-28 00:36:26 +00:00
2019-12-19 19:59:12 +00:00
You may optionally supply a filename for the example job to be written to. The
2023-02-02 17:47:47 +00:00
default filename for the generated file is "example.nomad.hcl".
2019-12-19 19:59:12 +00:00
Please refer to the [jobspec] and [drivers] pages to learn how to customize the
template.
2018-05-10 17:15:57 +00:00
## Init Options
2019-10-22 13:44:00 +00:00
- `-short`: If set, a minimal jobspec without comments is emitted.
- `-connect`: If set, the jobspec includes Consul Connect integration.
2023-02-02 15:37:40 +00:00
- `-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>`.
2018-05-10 17:15:57 +00:00
2016-10-28 00:36:26 +00:00
## Examples
Generate an example job file:
2020-05-18 20:53:06 +00:00
```shell-session
$ nomad job init
2023-02-02 17:47:47 +00:00
Example job file written to example.nomad.hcl
2016-10-28 00:36:26 +00:00
```
2023-01-25 17:31:14 +00:00
[jobspec]: /nomad/docs/job-specification 'Nomad Job Specification'
[drivers]: /nomad/docs/drivers 'Nomad Task Drivers documentation'