Offline Docker image exec

Hi there, I’m almost finished setting up my nomad cluster manager / job manager system. I’m a bone head cause I didn’t check if docker can be done offline. Let me explain.

From the documentation it seems like it will get the Docker Images from a cloud -repository.

Is it possible to have the docker images already on all my clients computers and use that image rather then from the cloud??

load - (Optional) Load an image from a tar archive file instead of from a remote repository. Equivalent to the docker load -i <filename> command.

Might be what I was looking for. Confirmation would be appreciated. Thanks.

It seems to work; if you enter the version. I thought I tested it once before without the version and it didn’t work… so this is good. :smiley:

Hi @ravi :wave:

Glad you got it to work. Yes, Nomad will use the local image first if available.

It’s always a good idea to specify the image tag instead of leaving it empty or using latest, otherwise Nomad will not know which image to use, so it will try asking the remote repository, which defaults to Docker Hub.

Hi I need to re-open this issue. I am unable to recreate the solution.

In my task file I use:

    "Config": {
        "image": "tait2:latest",
        "load": "/media/tait2.tar",
        "args": [],
        "command": ""

when nomad runs this job it tries to load the tar from a relative path and no the direct math I mentioned, as seen in the below alloc message:

Recent Events:
Time                       Type            Description
2021-12-12T16:06:10-05:00  Not Restarting  Error was unrecoverable
2021-12-12T16:06:10-05:00  Driver Failure  unable to open image archive: open /opt/nomad/alloc/94bae0df-b764-eccb-0000-97a8baf90c42/update_status_task/local/media/tait2.tar: no such file or directory
2021-12-12T16:06:10-05:00  Task Setup      Building Task Directory
2021-12-12T16:06:10-05:00  Received        Task received by client

I found the solution. Do not use tag :latest use something else. Nomad will look for it locally before trying to get it online.

1 Like

Yeah…in general is best to avoid latest because Nomad won’t be able to know if the job needs to be update and will always try to pull the image. From the docs:

If the tag is omitted or equal to latest the driver will always try to pull the image.

Glad you were able to get it working :slightly_smiling_face: