Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker driver: sha256-specified images keep getting re-downloaded #9619

Closed
exFalso opened this issue Dec 11, 2020 · 5 comments
Closed

Docker driver: sha256-specified images keep getting re-downloaded #9619

exFalso opened this issue Dec 11, 2020 · 5 comments

Comments

@exFalso
Copy link

exFalso commented Dec 11, 2020

Nomad version

v0.12.2

Operating system and Environment details

Arch Linux, NixOS

Issue

      task "sometask" {                                                                                                                                              
	driver = "docker"                                                                                                                                                 
        config {                                                                                                                                                          
	  image = "https://somecr.io/repo/someimage@sha256:ab12c3ab12c3ab12c3ab12c3..." 
          ...                                                                 
        }
        ...
      }

Causes nomad to keep invalidating the image as if the tag was latest causing spurious downloads on redeploy, even though this is the most specific way to refer to an image.

@krishicks
Copy link
Contributor

👋 Can you give a more complete reproduction scenario?

I tried:

$ nomad job init
Example job file written to example.nomad
$ sed -i 's/:3.2/@sha256:7b0a40301bc1567205e6461c5bf94c38e1e1ad0169709e49132cafc47f6b51f3/' example.nomad
$ nomad agent -dev

# in a new terminal
$ nomad job run example.nomad
$ sed '358ienv { foo = "bar" }' example.nomad | nomad job run -

I did not see that the updated job caused the image to be redownloaded when looking at the allocation events, nor in the agent logs.

It would be helpful to know what steps you're following to see an undesired image download.

@exFalso
Copy link
Author

exFalso commented Dec 17, 2020

Hmm we're getting these redownloads on other images as well (non-sha256-specified), perhaps the driver is misconfigured somehow. For me it reproduces by simply stopping+restarting the job in the UI. We're using proper nomad clients/servers. I'll double check the driver config

@notnoop
Copy link
Contributor

notnoop commented Dec 17, 2020

Hi @exFalso ! I wonder if that's an issue of image GC interactions, potentially exacerbated by the image_delay bug fixed in #9101. Once a task stops and the image isn't referenced by any other task, Nomad will GC it immediately (!!), and it will be re-downloaded again next time.

In 0.12.2, you can configure the docker gc behavior by setting the client config gc block in the client config:

plugin "docker" {
  config {
    # ... rest of config

    gc {
      # you can disable GC completely, hopefully with using another GC mechanism
      image       = false

      # alternatively, set a delay so images are only deleted after being unused for a long time
      image_delay = "1h"
    }
}

Let us know if that helps!

@exFalso
Copy link
Author

exFalso commented Jan 18, 2021

We've tested the suggestion in #9619 (comment) and it worked perfectly, thank you!

@exFalso exFalso closed this as completed Jan 18, 2021
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants