• HashiCorp Developer

  • HashiCorp Cloud Platform
  • Terraform
  • Packer
  • Consul
  • Vault
  • Boundary
  • Nomad
  • Waypoint
  • Vagrant
Nomad
  • Install
  • Intro
  • Tutorials
  • Documentation
  • API
  • Tools
  • Plugins
  • Sign up
Windows

Skip to main content
1 tutorial
  • Run Nomad as a Windows Service

  • Resources

  • Tutorial Library
  • Community Forum
    (opens in new tab)
  • Support
    (opens in new tab)
  • GitHub
    (opens in new tab)
  1. Developer
  2. Nomad
  3. Tutorials
  4. Windows
  5. Run Nomad as a Windows Service

Run Nomad as a Windows Service

  • 4min

  • NomadNomad

Nomad runs as a native Windows service once you register it with the operating system. You can use PowerShell cmdlets or the sc command, either on PowerShell or the Windows command line, to register Nomad with the Windows Service Manager.

In this tutorial, you will download the Nomad binary, register the Nomad service with the Service Manager, and finally start Nomad.

The steps presented here, assume that you have launched PowerShell or the Windows command prompt with Administrator capabilities.

Before installing Nomad, you will need to create a permanent directory for storing the configuration files. Once that directory is created, you will set it when starting Nomad with the -config option.

Install Nomad as a service

Download the Nomad binary for your architecture.

Use PowerShell's New-Service cmdlet or the sc command to create a service named Nomad, that will load the configuration files from the config-dir. Read the agent configuration documentation to learn more about configuration options.

Tip: Nomad does not use the Windows Event Log for logging, so ensure that you configure file-based logging in your Nomad configuration.

PS> New-Service -Name "Nomad" -BinaryPathName "<path to the Nomad.exe> agent -config=<path to configuration file>" -StartupType Automatic
Status   Name               DisplayName
------   ----               -----------
Stopped  Nomad              Nomad

For more details about the sc command, the Windows page for sc should help you get started.

sc.exe create "Nomad" binPath= "<path to the Nomad.exe> agent -config=<path to configuration file>" start= auto
[SC] CreateService SUCCESS

If you get an output that is similar to the one above, then your service is registered with the Service Manager.

If you get an error, please verify that you have specified the proper path to the binary, and check if you've entered the arguments correctly for the Nomad service.

Tip: Running the same command as defined in your service definition interactively can help you identify configuration errors that prevent Nomad from starting to the point where it writes to log.

Run Nomad as a service

You have a few options for starting the service.

Start the Windows Services user interface by clicking on the Start button and typing "services.msc". Once in the services user interface, look for Nomad under the service name. To start it, you can use the "Start Service" button in the toolbar or the "Start" option in the context menu.

The Start Service button is located in the Window Services GUI's toolbar. Click the button to start the service.

Image of the Windows Services UI showing the Nomad Service selected with the
mouse pointer over the Start Service button with the tooltip
showing.

You can use the Start option in the context menu to start the service. Right click on the Nomad service and select the Start option.

Image of the Windows Services UI showing the Nomad Service with the context
menu open. The mouse pointer is on the "Start" option, which is
highlighted

You can use the Start-Service cmdlet to start the Nomad service.

PS> Start-Service -Name "Nomad"

Verify that Nomad started with the Get-Service cmdlet.

PS> Get-Service -Name "Nomad"
Status   Name               DisplayName
------   ----               -----------
Running  Nomad              Nomad

You can use the sc command to start the Nomad service.

C:\> sc.exe start "Nomad"
SERVICE_NAME: Nomad
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 4  RUNNING (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0
        PID                : 8008
        FLAGS              :

The service automatically starts up during/after boot, so you don't need to launch Nomad from the command-line again.

Next Steps

In this tutorial, you setup a Nomad service on Windows. This process can be repeated to setup an entire datacenter of agents.

 Back to Collection
 Next Collection

On this page

  1. Run Nomad as a Windows Service
  2. Install Nomad as a service
  3. Run Nomad as a service
  4. Next Steps
Give Feedback(opens in new tab)
  • Certifications
  • System Status
  • Terms of Use
  • Security
  • Privacy
  • Trademark Policy
  • Trade Controls
  • Give Feedback(opens in new tab)