Make hashes between up
and configure
consistent
#11010
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What I did
Currently, when
docker compose config --hash [service]
computes a hash for the service, it deletes all other services before computing the hash. That means if a service depends on another service, theDependsOn
field gets deleted, causing the hash to be different than whendocker up
creates the labels.I prevented the dependencies from getting deleted before hash computation to fix this.
I also noticed that
docker up
does some modification to the platform of the image before doing the hash (I.e. if no platform was specified in the yaml file, the default one is set).docker config
doesn't do this at all. So I modifieddocker config
to apply these modifications before computing the hash.It could be argued that
config
shouldn't callapplyPlatform
. Take the scenario where a compose file contains services that don't have a platform specified. If that same file is run on two different machines with different default platforms, the hashes will be different. Personally, I think the hashes for the identical files should be different because they'll run on different platforms, but would love to get some feedback on that.Related issue
Fixes #10907
(not mandatory) A picture of a cute animal, if possible in relation to what you did