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

Make hashes between up and configure consistent #11007

Closed
wants to merge 4 commits into from

Conversation

mattwalo32
Copy link
Contributor

@mattwalo32 mattwalo32 commented Sep 15, 2023

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, the DependsOn field gets deleted, causing the hash to be different than when docker 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 modified docker config to apply these modifications before computing the hash.

It could be argued that config shouldn't call applyPlatform. 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
image

@mattwalo32 mattwalo32 closed this Sep 15, 2023
Signed-off-by: Matthew Walowski <[email protected]>
Signed-off-by: Matthew Walowski <[email protected]>
@mattwalo32 mattwalo32 changed the title Apply platform before hashing Make hashes between docker up and docker configure more consistent Sep 15, 2023
@mattwalo32 mattwalo32 changed the title Make hashes between docker up and docker configure more consistent Make hashes between up and configure consistent Sep 15, 2023
@mattwalo32 mattwalo32 reopened this Sep 15, 2023
@mattwalo32 mattwalo32 closed this Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] config --hash return incorrect hash value for containers with depends_on
1 participant