Skip to content

Dev Environment

nomad agent -dev -bind 0.0.0.0 -network-interface=en0

NOTE: -network-interface=en0 is required when using Docker Desktop (e.g. on Mac or Windows) so that networking between tasks work.

With Configuration File

my-config.hcl
bind_addr = "0.0.0.0"

plugin "docker" {
    config {
        volumes {
            enabled = true
        }
    }
}
nomad agent -dev -config=my-config.hcl

MacOS Docker Desktop tricks

There seems to be an issue with ipv6 on MacOS (it seems like Docker Desktop doesn't support it).

There are a few Github issues related to it:

A fix seems to be to tweak the IPv6 config on Mac by:

  1. Go to Settings > Wi-Fi > Click the "Details..." button next to your network
  2. Under "TCP/IP" set "Configure IPv6" to "Link-local only"
  3. Restart Nomad
  4. In the Nomad UI, verify the fix by going to the client node and check the "unique.network.ip-address" attribute and verify that its an ipv4 address (instead of a ipv6 one)

Volumes

locals {
    # Get the absolute path of the current directory
    path = abspath(".")
}

job "example" {
  datacenters = ["dc1"]

  group "group" {
    task "task" {
      driver = "docker"

      config {
        image = "busybox:1"
        command = "/bin/sh"
        args = ["-c", "echo ok; sleep 300"]
        volumes = ["${local.path}:/data"]
      }
    }
  }
}

From this Github comment


Last update: August 12, 2023
Created: June 3, 2023