for-win icon indicating copy to clipboard operation
for-win copied to clipboard

Update to 2.4.0.0: docker login from WSL2 distro fails with .../docker-credential-desktop.exe: Invalid argument

Open Him90 opened this issue 6 years ago • 31 comments

  • [x] I have tried with the latest version of my channel (Stable or Edge)
  • [x] I have uploaded Diagnostics
  • Diagnostics ID: D277A93A-1E25-4716-AE7A-56BBB29CD950/20201015094317

Expected behavior

Docker login, docker-compose work as before

Actual behavior

Docker login, docker-compose fail from WSL2 distro

Information

  • Windows Version: 19041
  • Docker Desktop Version: 2.4.0.0
  • Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: No

Steps to reproduce the behavior

(from powsershell)

  1. docker login -> works
  2. relogin works with existing credentials

(from wsl2 distro)

  1. docker login -> fails /c/Program Files/Docker/Docker/resources/bin/docker-credential-desktop.exe: Invalid argument Error saving credentials: error storing credentials - err: exit status 1, out: `

  2. docker-compose up (only hello-world as service) -> fails

/c/Program Files/Docker/Docker/resources/bin/docker-credential-desktop.exe: Invalid argument Traceback (most recent call last): File "docker/credentials/store.py", line 80, in _execute File "subprocess.py", line 411, in check_output File "subprocess.py", line 512, in run subprocess.CalledProcessError: Command '['/c/Program Files/Docker/Docker/resources/bin/docker-credential-desktop.exe', 'get']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "docker/auth.py", line 264, in _resolve_authconfig_credstore File "docker/credentials/store.py", line 35, in get File "docker/credentials/store.py", line 93, in _execute docker.credentials.errors.StoreError: Credentials store docker-credential-desktop.exe exited with "".

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "bin/docker-compose", line 3, in File "compose/cli/main.py", line 67, in main File "compose/cli/main.py", line 126, in perform_command File "compose/cli/main.py", line 1070, in up File "compose/cli/main.py", line 1066, in up File "compose/project.py", line 615, in up File "compose/service.py", line 356, in ensure_image_exists File "compose/service.py", line 1267, in pull File "compose/progress_stream.py", line 99, in get_digest_from_pull File "compose/service.py", line 1234, in _do_pull File "docker/api/image.py", line 396, in pull File "docker/auth.py", line 48, in get_config_header File "docker/auth.py", line 324, in resolve_authconfig File "docker/auth.py", line 235, in resolve_authconfig File "docker/auth.py", line 281, in _resolve_authconfig_credstore docker.errors.DockerException: Credentials store error: StoreError('Credentials store docker-credential-desktop.exe exited with "".') [3279] Failed to execute script docker-compose

  1. docker run hello-world -> pulls latest but with warning /c/Program Files/Docker/Docker/resources/bin/docker-credential-desktop.exe: Invalid argument

Him90 avatar Oct 15 '20 10:10 Him90

I have this issue as well.

Docker Desktop Version: 2.4.2.0 (48975)

I was able to get it to work by setting appendWindowsPath = true in /etc/wsl.conf.

[automount]
enabled = true

[interop]
appendWindowsPath = true

This could be related to #9278 as well. I was able to set appendWindowsPath = false after I disabled the build kit feature.

{
  "registry-mirrors": [],
  "insecure-registries": [],
  "debug": false,
  "experimental": true,
  "features": {
    "buildkit": false
  }
}

coverrt avatar Nov 05 '20 14:11 coverrt

For me, have this in my ~/.docker/config.json fixed docker-credentials errors.

{
  "_credSstore": "desktop",
  "experimental": "enabled"
}

Note the underscore, without the underscore I can't docker build ("docker-credential-desktop": executable file not found in $PATH). If I remove the underscore, it only fixes docker-compose, not docker build.

Warning, the file seems to update itself... (after docker update ? wsl --shutdown ?)

No related to my /etc/wsl.conf configuration where I have disable some options...

[interop]
enabled=false # enable launch of Windows binaries; default is true
appendWindowsPath=false # append Windows path to $PATH variable; default is true

image The login is ok!

Original post: https://github.com/docker/for-win/issues/6652#issuecomment-662960874

But is not normal to have to change this config.json manually...

duboiss avatar Nov 14 '20 18:11 duboiss

Issues go stale after 90 days of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale

docker-robott avatar Feb 14 '21 01:02 docker-robott

/remove-lifecycle stale

Just ran into this on a coworkers machine. Latest docker for win, latest version of windows, WSL2.

[automount]
enabled = true

[interop]
appendWindowsPath = true

in /etc/wsl2 fixed it for us as well.

rlabrecque avatar Feb 26 '21 06:02 rlabrecque

Anyone knows which executables from the Windows-side are necessary for authentication to work? Enabling appendWindowsPath causes tab-completion on the shell to be very slow but adding some specific folder Docker needs would be no problem.

I tried adding

  • C:\Program Files\Docker\Docker\resources\bin
  • C:\ProgramData\DockerDesktop\version-bin

unfortunately without success.

EDIT: Adding these directories to path actually did the trick, Docker authenticates using the credentials from Windows without having to use appendWindowsPath. Add the following to your profile:

export PATH="/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:$PATH"

thgeorgiou avatar Mar 26 '21 10:03 thgeorgiou

Issues go stale after 90 days of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale

docker-robott avatar Jun 24 '21 01:06 docker-robott

/remove-lifecycle stale

rlabrecque avatar Jun 24 '21 17:06 rlabrecque

Issues go stale after 90 days of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale

docker-robott avatar Sep 22 '21 01:09 docker-robott

/remove-lifecycle stale

Remains an issue

rlabrecque avatar Sep 22 '21 03:09 rlabrecque

For me, have this in my ~/.docker/config.json fixed docker-credentials errors.

{
  "_credSstore": "desktop",
  "experimental": "enabled"
}

Note the underscore, without the underscore I can't docker build ("docker-credential-desktop": executable file not found in $PATH). If I remove the underscore, it only fixes docker-compose, not docker build.

Warning, the file seems to update itself... (after docker update ? wsl --shutdown ?)

No related to my /etc/wsl.conf configuration where I have disable some options...

[interop]
enabled=false # enable launch of Windows binaries; default is true
appendWindowsPath=false # append Windows path to $PATH variable; default is true

image The login is ok!

Original post (I didn't need a symbolic link): #6652 (comment)

But is not normal to have to change this config.json manually...

This just worked for me, but remains to be seen how sustainable it is. Would like a proper fix at some point though.. the perils of using windows 🤒

jasonharris438 avatar Oct 11 '21 07:10 jasonharris438

Same issue, since I installed Windows 11, I have:

> docker login
/usr/bin/docker-credential-desktop.exe: Invalid argument

olivierchatry avatar Oct 15 '21 11:10 olivierchatry

Same issue, since I installed Windows 11, I have:

> docker login
/usr/bin/docker-credential-desktop.exe: Invalid argument

Hi @olivierchatry, try to remove the file: $HOME/.docker/config.json, it worked for me.

-> Make sure that you backup the file first....

thaylongs avatar Oct 15 '21 18:10 thaylongs

@thaylongs thanks ! but it did not help. Just running the command give me the same results : image

Tried unstalling and resintalling, still the same error.

Update, running it in a normal window shell does not give me any error :

image

So it is really about wsl.

olivierchatry avatar Oct 16 '21 12:10 olivierchatry

Turning off buildkit ( "buildkit": false in json config ) made it work. Would be great if this can be fixed.

olivierchatry avatar Oct 17 '21 14:10 olivierchatry

So, turn out, I installed WSl using the new app store from windows 11, and this seems to not work correctly with docker desktop. Uninstalled it ( it work alongside the normal "add remove feature" way of installing ), and then everything working find and dandy.

olivierchatry avatar Oct 17 '21 17:10 olivierchatry

I was able to get it to work via changing the symlink for docker-credential-desktop.exe in the wsl /usr/bin:

sudo ln -sf /mnt/c/Program\ Files/Docker/Docker/resources/bin/docker-credential-desktop.exe /usr/bin

The existing symlink pointed to a different executable that was broken:

/usr/bin/docker-credential-desktop.exe -> /mnt/wsl/docker-desktop/cli-tools/usr/bin/docker-credential-desktop.exe

bwmeier avatar Dec 14 '21 18:12 bwmeier

Issues go stale after 90 days of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale

docker-robott avatar Mar 14 '22 01:03 docker-robott

/remove-lifecycle stale Still an issue.

ghost avatar Apr 05 '22 10:04 ghost

I am getting a similar error message when doing docker pull from WSL.
My IT org has enabled AppLocker on Windows, and it is blocking /usr/bin/docker-credential-desktop.exe.

WSL2

$ docker pull ubuntu
Using default tag: latest
/usr/bin/docker-credential-desktop.exe: Invalid argument
latest: Pulling from library/ubuntu
Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
Status: Image is up to date for ubuntu:latest
docker.io/library/ubuntu:latest

Windows Powershell

Get-WinEvent 'Microsoft-Windows-AppLocker/*' -MaxEvents 100000 | Where LevelDisplayName -eq 'Error' | Format-Table -Wrap

   ProviderName: Microsoft-Windows-AppLocker

TimeCreated                     Id LevelDisplayName Message
-----------                     -- ---------------- -------
11-05-2022 12:53:36           8004 Error            \\WSL$\UBUNTU\MNT\WSL\DOCKER-DESKTOP\CLI-TOOLS\USR\BIN\DOCKER-CREDENTIAL-DESKTOP.EXE was prevented from running.
11-05-2022 12:45:17           8004 Error            \\WSL$\UBUNTU\MNT\WSL\DOCKER-DESKTOP\CLI-TOOLS\USR\BIN\DOCKER-CREDENTIAL-DESKTOP.EXE was prevented from running.
11-05-2022 11:03:33           8004 Error            \\WSL$\UBUNTU\MNT\WSL\DOCKER-DESKTOP\CLI-TOOLS\USR\BIN\DOCKER-CREDENTIAL-DESKTOP.EXE was prevented from running.

tlgDJPorv avatar May 11 '22 11:05 tlgDJPorv

this solved my problem - https://forums.docker.com/t/docker-credential-desktop-exe-executable-file-not-found-in-path-using-wsl2/100225/5

Solution:
In ~/.docker/config.json change credsStore to credStore

PetrMc avatar Jul 21 '22 19:07 PetrMc