-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Remove Image during ensureImageExists so it does not impact config-hash #9350
Conversation
Image name is not relevant as tags aren't immutable. Better use image digest. (see com.docker.compose.image label) |
Hi, See test case:
On the current v2, the hash is only correct once the patch is applied. I'm hoping the patch doesn't affect any other operation since it's in Alternatively, I suppose, you could stop the hash using ServiceConfig.Image when no image is specified in the docker-compose.yml, which I think is the cause of this. |
ok got it. |
@ndeloof Yes, indeed. I wasn't sure about that line so I was hoping to raise the test-case, explained with an example fix (which seemed less intrusive) and then see what someone more experienced with the codebase made of it. Do you need the PR changed to remove that line instead or would you prefer to handle it yourself since the fix becomes a "simple" one line removal? (I have no knowledge on whether anything depends on that being set or not!) |
As you reported and investigated this issue, please update your PR to remove this line so you get the credits for fixing this issue :D |
Signed-off-by: Kenny Millington <[email protected]>
Done, but I have only tested my specific use-case, I can do a bit more if required but not right now! |
What I did
I have a service, let's call it s1 which is running and has a config-hash thus:
However, when I run
docker compose config --hash s1
I get this:This appears to be because if service does not specify an
Image
(e.g. it hasBuild
instead) this is not taken into account when runningconfig --hash
but is part of the hash that is set as part of the label.Once I apply this change to the config command, the results are thus:
This now matches the config-hash label.
Use case: It would be nice if scripts/tools could easily compare the running hash with the expected/config hash to determine whether an update is required or not.
Related issue
n/a
(not mandatory) A picture of a cute animal, if possible in relation with what you did
🐶 🤷♂️