Files
nomad/website/content/docs/commands/job/allocs.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

77 lines
2.7 KiB
Plaintext

---
layout: docs
page_title: 'nomad job allocs command reference'
description: |
The `nomad job allocs` command lists allocations for a job.
---
# `nomad job allocs` command reference
The `job allocs` command is used to display the allocations for a
particular job.
## Usage
```plaintext
nomad job allocs [options] <job>
```
The `job allocs` command requires a single argument, the job ID or an ID
prefix of a job to display the list of allocations for.
When ACLs are enabled, this command requires a token with the `read-job`
capability for the job's namespace. The `list-jobs` capability is required to
run the command with a job prefix instead of the exact job ID.
## Options
- `-all`: Display all allocations matching the job ID, even those from an
older instance of the job.
- `-json`: Output the allocations in JSON format.
- `-t`: Format and display the allocations using a Go template.
- `-verbose`: Show full information.
## Examples
List the allocations for a particular job:
```shell-session
$ nomad job allocs example
ID Node ID Task Group Version Desired Status Created Modified
c2b4606d 35085106 cache 2 run running 21s ago 10s ago
c413424b 35085106 cache 2 run pending 1m8s ago 11s ago
```
Verbose listing of allocations for a particular job:
```shell-session
$ nomad job allocs -verbose example
ID Eval ID Node ID Node Name Task Group Version Desired Status Created Modified
c2b4606d-1b02-0d8d-5fdd-031167cd4c91 5e2badb6-b7cf-5177-8281-8fe14f7193d2 35085106-9480-b465-a348-deb745024394 ubuntu cache 2 run running 2021-09-23T14:45:09-04:00 2021-09-23T14:45:19-04:00
c413424b-d80e-9bc6-ea92-a02b336eaaf5 5e2badb6-b7cf-5177-8281-8fe14f7193d2 35085106-9480-b465-a348-deb745024394 ubuntu cache 2 run pending 2021-09-23T14:44:22-04:00 2021-09-23T14:45:19-04:00
```
Format job allocations using a Go template:
```shell-session
$ nomad job allocs -t '{{ range . }}{{ println .ID }}{{ end }}' example
c2b4606d-1b02-0d8d-5fdd-031167cd4c91
c413424b-d80e-9bc6-ea92-a02b336eaaf5
```
Use a Go template to filter only allocations which are running
```shell-session
$ nomad job allocs -t '{{ range . }}{{ if eq .ClientStatus "running" }}{{ println .ID }}{{ end }}{{ end }}' example
c2b4606d-1b02-0d8d-5fdd-031167cd4c91
```
Refer to the [Format Nomad Command Output With
Templates](/nomad/tutorials/templates/format-output-with-templates) tutorial for
more examples of using Go templates to format Nomad CLI output.
## General options
@include 'general_options.mdx'