Docker volumes errors no matter what I try

I have spent the last two hours trying to run a job and mount a volume on the host into the docker containers. The documentation just doesn’t make sense. I can’t believe how hard this is.

Facts:
directory on the host I am trying to mount: /home/brad
directory in the container to mount to: /data

nomad client config:

client {
  enabled           = true
  network_interface = "enp94s0f1"
  options = {
    "driver.allowlist" = "docker"
  }
  host_volume "home" {
    path      = "/home/brad"
    read_only = false
  }
}

Ok now in my job spec file.

job "bradley" {
  datacenters = ["miami"]
  type        = "service"

  group "game" {
    count = 1
    network {
      port "http" {
        to = 30000
      }
    }

    volume "home" {
      type      = "host"
      read_only = false
      source    = "home"
    }

    task "fvtt" {
      driver = "docker"
      user   = "2001:2001"

      config {
        image = "registry.gitlab.com/"

        volume_mount {
          volume      = "home"
          destination = "/data"
          read_only   = false
        }
      }
    }
  }
}

The error I get
Nov 20 02:43:08 app1 nomad[128694]: 2021-11-20T02:43:08.389Z [ERROR] client.alloc_runner.task_runner: running driver failed: alloc_id=45fdad67-c1f4-0b03-f5ef-1007172179a4 task=fvtt Nov 20 02:43:08 app1 nomad[128694]: error= Nov 20 02:43:08 app1 nomad[128694]: | 2 errors occurred: Nov 20 02:43:08 app1 nomad[128694]: | * failed to parse config: Nov 20 02:43:08 app1 nomad[128694]: | * Invalid label: No argument or block type is named "volume_mount". Nov 20 02:43:08 app1 nomad[128694]: | Nov 20 02:43:08 app1 nomad[128694]:

What in gods name am I doing wrong. I have followed so many examples. I followed this one… example which looks to be the most clear and clean example.

Please help.
Thanks.
Brad

just a quick glance, but the volume_mount has gone inside config , it should be inside task

I really should have just stopped and taken an break, tunnel vision sucks. Thank you for your help.

This might be helpful as well to others. When using the “mount” option for the docker config, it talks about making sure that docker.volumes.enable is true. But it never talks about how to do that. So after some digging you need to do it in the nomad config on your client machines.

So to use

mount {
          type     = "bind"
          target   = "/data"
          source   = "/home/brad"
          readonly = false
        }

You need this in your config

plugin "docker" {
  config {
    volumes {
      enabled = true
    }
  }
}