Open ddevoogt opened 1 year ago
In docker desktop 4.18 it has worked previously.
Are you sure? I can hardly imagine that.
The code example you provided doesn't pass the credentials to CreateImageAsync(ImagesCreateParameters, AuthConfig, IProgress<JSONMessage>, CancellationToken)
. Docker.DotNet
doesn't automatically read and configure private Docker registry credentials from the config.json
. To properly configure the credentials, you need to obtain them and set them accordingly in the AuthConfig
instance. Docker offers several methods to configure credentials for private registries. The way you obtain the credentials from config.json
may vary slightly depending on the configuration.
Are you sure? I can hardly imagine that.
Here is some proof to help your uncertainty
➜ Dynamo.csharp git:(main) ✗ docker version | grep Desktop
Server: Docker Desktop 4.19.0 (106363)
➜ Dynamo.csharp git:(main) ✗ dotnet test test/Dynamo.IntegrationTests --filter "DependentEntityDataStoreTests.DeleteItemAsync_ByEntity_DeleteExistingItem_ItemDoesNotExist" | grep Docker.DotNet.DockerApiException
[xUnit.net 00:00:00.62] xxxx.Dynamo.IntegrationTests.DependentEntityDataStoreTests.DeleteItemAsync_ByEntity_DeleteExistingItem_ItemDoesNotExist [FAIL]
[xUnit.net 00:00:00.63] xxxx.Dynamo.IntegrationTests.IndependentEntityDataStoreTests.DeleteItemAsync_ByEntity_DeleteExistingItem_ItemDoesNotExist [FAIL]
-------- Docker.DotNet.DockerApiException : Docker API responded with status code=ProxyAuthenticationRequired, response=Please run 'docker login'
-------- Docker.DotNet.DockerApiException : Docker API responded with status code=ProxyAuthenticationRequired, response=Please run 'docker login'
[xUnit.net 00:00:00.55] xxxx.Dynamo.IntegrationTests.DependentEntityDataStoreTests.DeleteItemAsync_ByEntity_DeleteExistingItem_ItemDoesNotExist [FAIL]
[xUnit.net 00:00:00.56] xxxx.Dynamo.IntegrationTests.IndependentEntityDataStoreTests.DeleteItemAsync_ByEntity_DeleteExistingItem_ItemDoesNotExist [FAIL]
-------- Docker.DotNet.DockerApiException : Docker API responded with status code=ProxyAuthenticationRequired, response=Please run 'docker login'
-------- Docker.DotNet.DockerApiException : Docker API responded with status code=ProxyAuthenticationRequired, response=Please run 'docker login'
➜ Dynamo.csharp git:(main) ✗ open ~/Downloads/Docker_4.18.dmg
➜ Dynamo.csharp git:(main) ✗ echo "stop docker, installs old docker"
stop docker, installs old docker
➜ Dynamo.csharp git:(main) ✗ docker version | grep Desktop
Cannot connect to the Docker daemon at unix:///Users/xxxxx/.docker/run/docker.sock. Is the docker daemon running?
➜ Dynamo.csharp git:(main) ✗ open /Applications/Docker.app
➜ Dynamo.csharp git:(main) ✗ docker version | grep Desktop
Server: Docker Desktop 4.18.0 (104112)
➜ Dynamo.csharp git:(main) ✗ dotnet test test/Dynamo.IntegrationTests --filter "DependentEntityDataStoreTests.DeleteItemAsync_ByEntity_DeleteExistingItem_ItemDoesNotExist"
Determining projects to restore...
All projects are up-to-date for restore.
Dynamo.TestUtilities -> /Users/xxxxx/dev/Dynamo.csharp/src/Dynamo.TestUtilities/bin/Debug/net7.0/xxxx.Dynamo.TestUtilities.dll
Dynamo -> /Users/xxxxx/dev/Dynamo.csharp/src/Dynamo/bin/Debug/net6.0/xxxx.Dynamo.dll
Dynamo.TestUtilities -> /Users/xxxxx/dev/Dynamo.csharp/src/Dynamo.TestUtilities/bin/Debug/net6.0/xxxx.Dynamo.TestUtilities.dll
Dynamo -> /Users/xxxxx/dev/Dynamo.csharp/src/Dynamo/bin/Debug/net7.0/xxxx.Dynamo.dll
Dynamo.TestData -> /Users/xxxxx/dev/Dynamo.csharp/test/Dynamo.TestData/bin/Debug/net7.0/xxxx.Dynamo.TestData.dll
Dynamo.IntegrationTests -> /Users/xxxxx/dev/Dynamo.csharp/test/Dynamo.IntegrationTests/bin/Debug/net7.0/xxxx.Dynamo.IntegrationTests.dll
Dynamo.TestData -> /Users/xxxxx/dev/Dynamo.csharp/test/Dynamo.TestData/bin/Debug/net6.0/xxxx.Dynamo.TestData.dll
Dynamo.IntegrationTests -> /Users/xxxxx/dev/Dynamo.csharp/test/Dynamo.IntegrationTests/bin/Debug/net6.0/xxxx.Dynamo.IntegrationTests.dll
Test run for /Users/xxxxx/dev/Dynamo.csharp/test/Dynamo.IntegrationTests/bin/Debug/net7.0/xxxx.Dynamo.IntegrationTests.dll (.NETCoreApp,Version=v7.0)
Microsoft (R) Test Execution Command Line Tool Version 17.5.0 (arm64)
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Passed! - Failed: 0, Passed: 2, Skipped: 0, Total: 2, Duration: 19 ms - xxxx.Dynamo.IntegrationTests.dll (net7.0)
Test run for /Users/xxxxx/dev/Dynamo.csharp/test/Dynamo.IntegrationTests/bin/Debug/net6.0/xxxx.Dynamo.IntegrationTests.dll (.NETCoreApp,Version=v6.0)
Microsoft (R) Test Execution Command Line Tool Version 17.5.0 (arm64)
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Passed! - Failed: 0, Passed: 2, Skipped: 0, Total: 2, Duration: 16 ms - xxxx.Dynamo.IntegrationTests.dll (net6.0)
➜ Dynamo.csharp git:(main) ✗
Also, this is a public image.
Are you using a corporate proxy? Could you please test what happens if you include the credentials in the AuthConfig
instance? You should be able to get the credentials via echo https://index.docker.io/v1/ | docker-credential-desktop get
. I have tested the Docker login (without enforcing the sign-up) and it worked fine. Although Docker Desktop has made a few changes regarding the Docker login and proxy, I have not found any obvious change that would break the behavior.
echo https://index.docker.io/v1/ | docker-credential-desktop get
{"ServerURL":"https://index.docker.io/v1/","Username":"me","Secret":"my_Password_That_I_replaced"}
Does Docker.Dotnet have a call to make the echo https://index.docker.io/v1/ | docker-credential-desktop get
call or to get the currently logged in user on the machine? That might work.
It works with with the AuthConfig
on both versions.
await dockerClientImages.CreateImageAsync(
parameters,
new AuthConfig()
{ ServerAddress = "https://index.docker.io/v1/", Username = "meMySelfAndI", Password = "StopSniffingYo!I_REPLACED_THIS!!!!!" },
progress);
Does Docker.Dotnet have a call to make the
echo https://index.docker.io/v1/ | docker-credential-desktop get
call or to get the currently logged in user on the machine? That might work.
No, it is not built-in. You need to gather the information yourself.
how do we request a feature that uses the same credentials for the docker login? At least with say aws login, you can can use any api/cli with "default" credentials and it goes through the credential chain (Envs, .confs, etc). Any suggestions?
I am not sure if I understand you correctly. Are you asking how to implement the mechanism to receive credentials? Docker (docker login) supports different ways to store credentials. Essentially, you need to implement the reverse process. Perhaps this implementation will help you understand how to implement different credential providers.
Output of
dotnet --info
:What version of Docker.DotNet?:
Output of
docker version
Steps to reproduce the issue:
docker login
What actually happened?: Exception occured:
What did you expect to happen?: It should pull down the image without an exception.
Has this worked before? In docker desktop 4.18 it has worked previously.
Additional information Since we are already logged in with docker desktop, and docker engine, i'd assume that we'd all ready be logged in?