dockernomad

How can I make a nomad job use a local docker image?


nomad docker image will be fetched from Docker Hub. But I have want use some local images. How can I use theme. (I dont want to use private repo)

Example I want to use local image test


> docker images
REPOSITORY                         TAG                 IMAGE ID            CREATED             SIZE
test                        latest              da795ca8a32f        36 minutes ago      567MB
job "test" {
  datacenters = ["dc1"]

  group "example" {
    task "test" {
      driver = "docker"

      config {
        image = "test"
      }

      resources {
        cpu = 500
        memory = 256 
      }
    }
  }
}

It's wrong !


Solution

  • Looking at Nomad's source code here and here, it seems that using machine local images is not supported. That would make sense, as in a cluster environment with several nodes, the scheduler needs to be able to get the image irrespective of which machine the job is allocated to.

    (One possible workaround would be to run a registry service within the Nomad cluster, and use whichever storage backend is most convenient for you)