-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add http prefix when docker config detect a insecure registry
#39840
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
Conversation
|
@dotnet-policy-service agree |
|
Separately, this change made a bunch of other tests fail because some of the test systems don't have Docker available - I think if we can't launch Docker we should default to the previous behavior here - the registry should be inferred to be secure-by-default. |
|
This is also relevant to the issue request dotnet/sdk-container-builds#338. |
|
Just curious, would rid potentially lead to unexpectedly getting an image from an insecure registry due to it for some reason not being in the secure registry I expected (or that registry not responding) |
|
That's possible, especially if you didn't fully qualify the image name - e.g.
The SDK, however, currently only expands 'partial' image names into Docker Hub references, so we aren't directly vulnerable to hijacking in that way. |
|
Thanks for your review.
|
|
The work is done. All test passed. please check again @baronfel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a question about the conditional, and I'd like another dev on the containers team to check.
src/Containers/Microsoft.NET.Build.Containers/ContainerHelpers.cs
Outdated
Show resolved
Hide resolved
|
Ok,Is there anything else you need me to do? |
|
@dameng324 nope, I think this is good to go! Thank you for your work on this feature. I'm going to approve it, but I've also tagged the other SDK Containers feature maintainers so they can give it a look. |
|
/backport to release/8.0.4xx |
|
Started backporting to release/8.0.4xx: https://github.com/dotnet/sdk/actions/runs/9098104332 |
|
Thank you for this excellent contribution @dameng324 - I've started a backport to 8.0.400 so that this will release in August's SDK release. |
As discussed in dotnet/sdk-container-builds#558 (reply in thread)
When add http/https prefix, It will check the local docker config, if found it is an insecure registery, add
httpprefix instead ofhttpsprefix as before.By the way, this pr fix another bug in
DockerCli.GetDockerConfig. If docker daemon is not running, It will throw aDockerLoadExceptioninstead of return a invaild result.I test in my local machine.
daemon.json:
{ "builder": { "gc": { "defaultKeepStorage": "20GB", "enabled": true } }, "experimental": false, "insecure-registries": [ "dockerhub.shengguanda.com" ] }test code:
result: