Skip to content

clementd64/docker-nomad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Nomad server in Docker

This image provide a thin wrapper around hashicorp/nomad to run a Nomad server.

It use a configuration similar to hashicorp/consul and hashicorp/vault

⚠️ Running agent in client mode is not supported.

Usage

Because running nomad in server mode always require environment specific configuration (like bootstrap_expect), the agent is run with server mode disabled by default.

No init process is used. Using the Docker built-in init process is highly recommanded for zombie processes reaping.

docker run --rm --init ghcr.io/clementd64/nomad:1.6.1 agent -server -bootstrap-expect=1

The configuration can also be specified using the NOMAD_LOCAL_CONFIG environment variable in hcl or json format

docker run --rm --init -e NOMAD_LOCAL_CONFIG='{"server": {"enabled": true, "bootstrap_expect": 1}}' ghcr.io/clementd64/nomad:1.6.1

The configuration is read from /nomad/config (configurable using NOMAD_CONFIG_DIR). The content of NOMAD_LOCAL_CONFIG is written into local.json in this directory on startup.

Data is stored in /nomad/data (configurable using NOMAD_CONFIG_DIR environment variable).

The image run as a non root user named nomad.

With docker compose

services:
  nomad:
    image: ghcr.io/clementd64/nomad:1.6.1
    hostname: nomad
    init: true
    environment:
      NOMAD_LOCAL_CONFIG: |
        server {
          enabled          = true
          bootstrap_expect = 1
        }
    volumes:
      - nomad-data:/nomad/data
    ports:
      - 4646:4646
      - 4647:4647
      - 4648:4648

volumes:
  nomad-data:

Credits

This image is based on the official Nomad Docker image.

The entrypoint script is based on the Consul entrypoint script from the official Docker image.