github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/docs/commands/index.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: Commands (CLI)
     4  sidebar_title: Commands (CLI)
     5  description: >
     6    Nomad can be controlled via a command-line interface. This page documents all
     7    the commands Nomad accepts.
     8  ---
     9  
    10  # Nomad Commands (CLI)
    11  
    12  Nomad is controlled via a very easy to use command-line interface (CLI).
    13  Nomad is only a single command-line application: `nomad`, which
    14  takes a subcommand such as "agent" or "status". The complete list of
    15  subcommands is in the navigation to the left.
    16  
    17  The Nomad CLI is a well-behaved command line application. In erroneous cases,
    18  a non-zero exit status will be returned. It also responds to `-h` and `--help`
    19  as you would most likely expect.
    20  
    21  To view a list of the available commands at any time, just run Nomad
    22  with no arguments. To get help for any specific subcommand, run the subcommand
    23  with the `-h` argument.
    24  
    25  Each command has been conveniently documented on this website. Links to each
    26  command can be found on the left.
    27  
    28  ## Autocomplete
    29  
    30  Nomad's CLI supports command autocomplete. Autocomplete can be installed or
    31  uninstalled by running the following on bash or zsh shells:
    32  
    33  ```shell-sessionnomad -autocomplete-install
    34  $ nomad -autocomplete-uninstall
    35  ```
    36  
    37  ## Command Contexts
    38  
    39  Nomad's CLI commands have implied contexts in their naming convention. Because
    40  the CLI is most commonly used to manipulate or query jobs, you can assume that
    41  any given command is working in that context unless the command name implies
    42  otherwise.
    43  
    44  For example, the `nomad job run` command is used to run a new job, the `nomad status` command queries information about existing jobs, etc. Conversely,
    45  commands with a prefix in their name likely operate in a different context.
    46  Examples include the `nomad agent-info` or `nomad node drain` commands,
    47  which operate in the agent or node contexts respectively.
    48  
    49  ### Remote Usage
    50  
    51  The Nomad CLI may be used to interact with a remote Nomad cluster, even when the
    52  local machine does not have a running Nomad agent. To do so, set the
    53  `NOMAD_ADDR` environment variable or use the `-address=<addr>` flag when running
    54  commands.
    55  
    56  ```shell-sessionNOMAD_ADDR=https://remote-address:4646 nomad status
    57  $ nomad status -address=https://remote-address:4646
    58  ```
    59  
    60  The provided address must be reachable from your local machine. There are a
    61  variety of ways to accomplish this (VPN, SSH Tunnel, etc). If the port is
    62  exposed to the public internet it is highly recommended to configure TLS.