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

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

Open
2 tasks done
Him90 opened this issue Oct 15, 2020 · 31 comments

Comments

@Him90
Copy link

Him90 commented Oct 15, 2020

  • I have tried with the latest version of my channel (Stable or Edge)
  • 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
@coverrt
Copy link

coverrt commented Nov 5, 2020

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
  }
}

@duboiss
Copy link

duboiss commented Nov 14, 2020

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: #6652 (comment)

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

@docker-robott
Copy link
Collaborator

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

@rlabrecque
Copy link

rlabrecque commented Feb 26, 2021

/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.

@thgeorgiou
Copy link

thgeorgiou commented Mar 26, 2021

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"

@docker-robott
Copy link
Collaborator

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

@rlabrecque
Copy link

/remove-lifecycle stale

@docker-robott
Copy link
Collaborator

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

@rlabrecque
Copy link

/remove-lifecycle stale

Remains an issue

@jasonharris438
Copy link

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 🤒

@olivierchatry
Copy link

olivierchatry commented Oct 15, 2021

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

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

@thaylongs
Copy link

thaylongs commented Oct 15, 2021

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....

@olivierchatry
Copy link

olivierchatry commented Oct 16, 2021

@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
Copy link

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

@olivierchatry
Copy link

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.

@bwmeier
Copy link

bwmeier commented Dec 14, 2021

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

@docker-robott
Copy link
Collaborator

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

@pys-arhs
Copy link

pys-arhs commented Apr 5, 2022

/remove-lifecycle stale
Still an issue.

@tlgDJPorv
Copy link

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.

@PetrMc
Copy link

PetrMc commented Jul 21, 2022

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

@sliekens
Copy link

sliekens commented Jul 22, 2022

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

It's not a solution. It only appears to work because "credStore" is not a valid config key so it is ignored, docker defaults to not using a store (i.e. store credentials in plaintext). If you check the contents of your ~/.docker/config.json again, you will find your password in readable text.

The number of people who implemented this "fix" is worrisome.

update
You can instead use @bwmeier's workaround

But in my experience this symlink gets destroyed after every reboot, and recreating it can't be automated because the command requires root. There is a variation on this that does not require root: add the cli tools to your PATH.

PATH="/mnt/c/Program Files/Docker/Docker/resources/bin":$PATH

You can put this in your ~/.profile file to make it survive reboots.

@puellanivis
Copy link

Hm… I just randomly started hitting this as well, but it’s not just docker-credential-desktop.exe it seems all of my windows executables are dying with Invalid argument.

$ /mnt/c/Windows/System32/findstr.exe
/mnt/c/Windows/System32/findstr.exe: Invalid argument

@puellanivis
Copy link

FYI came across this: microsoft/WSL#6170 seems a common problem with docker at times, but sometimes also git? 🤷‍♀️

@JustusNBB
Copy link

I just ran into this after onboarding to another project and switching IDEs. For some reason VSCode sets up the PS into WSL env without this issue, while I have to try workarounds posted here, to get it to work within IntelliJ!

@rmoreas
Copy link

rmoreas commented Oct 2, 2022

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 thanks for sharing. AppLocker was also the problem in our case!

@docker-robott
Copy link
Collaborator

There hasn't been any activity on this issue for a long time.
If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment.
If not, this issue will be closed in 30 days.

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

/lifecycle stale

@masoud-maghsoudi
Copy link

Windows 11, Version 22H2 (OS Build 22621.1105)
Ubuntu 22.04 under WSL2
Docker version 20.10.22, build 3a2c30b

I am still having this issue

/remove-lifecycle stale

@docker-robott
Copy link
Collaborator

There hasn't been any activity on this issue for a long time.
If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment.
If not, this issue will be closed in 30 days.

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

/lifecycle stale

@ltorres6
Copy link

Having this same issue.
/remove-lifecycle stale

@parzydlo
Copy link

@sliekens's suggestion finally fixed the problem for me where all previously mentioned fixes failed

@mtjrider
Copy link

mtjrider commented Nov 6, 2023

I am not sure if this helps anyone, but none of the recommended fixes or workarounds solved this issue for me.
I am on Windows 11 using Docker Desktop 4.25.0 with the following version printed from Ubuntu WSL.

$ docker --version
Docker version 24.0.6, build ed223bc

To fix the invalid argument error, I did the following:

  1. Opened Docker Desktop
  2. Navigated to Settings (upper right cog wheel)
  3. Under the Resources menu, select WSL Integration
  4. Check Enable integration with my default WSL distro and Ubuntu
  5. Shutdown WSL at the command-line with wsl --shutdown
  6. Quit Docker Desktop

After restarting Docker Desktop and the WSL distribution, the credential-store errors vanished. See the image below for what my configuration looks like in the Docker Desktop GUI.

It seems odd to me that I would have to explicitly enable Ubuntu when the default WSL distro was enabled.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests