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 !
I'm not sure if this can be treated as an answer or a "hack".
But if you want Nomad to use docker image that is already present on a node the image MUST NOT be tagged latest.
For testing I tag my images as IMAGE:local
. This way Nomad uses it if present, pulls it from remote if not.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With