Compose: `docker-compose up` fails in WSL 2 environment

Created on 2 Jun 2020  路  15Comments  路  Source: docker/compose

Description of the issue

Whenever I run docker-compose up in my WSL 2 environment, it fails with the error:

docker.credentials.errors.InitializationError: docker-credential-desktop.exe not installed or not available in PATH
[519] Failed to execute script docker-compose

It's complaining that docker-credential-desktop is not available, however in the same session I can run docker-credential-desktop -h and get the help text output.

I am also able to use docker run to build and run my container without any problems.

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.25.5, build 8a1c60f6
docker-py version: 4.1.0
CPython version: 3.7.5
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

Output of docker version

Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b7f0
 Built:             Wed Mar 11 01:25:46 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:29:16 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker-compose config
(Make sure to add the relevant -f and other flags)

services:
  happy:
    build:
      context: /home/blake/repos/happy
      dockerfile: Dockerfile
    container_name: happy
    environment:
      CHOKIDAR_USEPOLLING: "true"
    ports:
    - published: 3001
      target: 3000
    volumes:
    - /home/blake/repos/happy:/app:rw
    - /app/node_modules
version: '3.7'

Steps to reproduce the issue

  1. Create a WSL 2 environment (I'm running Ubuntu 20.04)
  2. Install Docker Desktop
  3. Create a Dockerfile and attempt to run docker-compose up on it

Observed result

The above error message

Expected result

The container is built and run

Stacktrace / full error message

Traceback (most recent call last):
  File "bin/docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 72, in main
  File "compose/cli/main.py", line 128, in perform_command
  File "compose/cli/main.py", line 1077, in up
  File "compose/cli/main.py", line 1073, in up
  File "compose/project.py", line 548, in up
  File "compose/service.py", line 367, in ensure_image_exists
  File "compose/service.py", line 1106, in build
  File "site-packages/docker/api/build.py", line 261, in build
  File "site-packages/docker/api/build.py", line 308, in _set_auth_headers
  File "site-packages/docker/auth.py", line 301, in get_all_credentials
  File "site-packages/docker/auth.py", line 287, in _get_store_instance
  File "site-packages/docker/credentials/store.py", line 25, in __init__
docker.credentials.errors.InitializationError: docker-credential-desktop.exe not installed or not available in PATH
[519] Failed to execute script docker-compose

Additional information

OS version: Windows 10 version 2004 build 19041.264
WSL 2 distro: Ubuntu 20.04

The way I got my setup was:

  • Installed WSL 2 with latest Windows update
  • Installed Docker Desktop and enabled the WSL features
kinbug

Most helpful comment

Removing the file worked for me:
rm ~/.docker/config.json

All 15 comments

Update: something I didn't mention above was that I moved my WSL instance to my D drive (because my C drive is pretty full). I thought maybe that could cause problems so I just tried a fresh Ubuntu 20.04 install on the C drive and it seems to be working fine there. This is a temporary workaround which is fine for now but I would like the issue to be fixed still. Thanks :)

i have the same issue in Ubuntu 18.04, tried to reinstall both docker and the Ubuntu but still getting the same error.

same issue here, Im trying to run docker-compose up for this project.
https://github.com/big-data-europe/docker-hadoop

looks like they had same issue with mac.
https://github.com/docker/for-mac/issues/3785
I just added _ before credsStore in this file ( ~/.docker/config.json ) {"_credsStore":"desktop.exe"}
I don't know what does that config do but I'm not getting the error anymore.

Removing the file worked for me:
rm ~/.docker/config.json

I did this, and effect me

  1. rm ~/.docker/config.json
  2. docker execute command with sudo prefix : sudo docker-compose -d --build####your option

In my WSL2 Debian, I disable windows path, so I add docker-credential-desktop.exe path to ~/.bashrc:

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

and after run source ~/.bashrc, my docker-compose work well.

I have the same issue. I have tried removing the .docker/config.json, commenting out the credsStore attribute, and also adjusting the PATH as suggested above. None of them worked. The only thing that worked was putting the underscore ("_") in front of the credsStore attribute.

I have the same issue. I have tried removing the .docker/config.json, commenting out the credsStore attribute, and also adjusting the PATH as suggested above. None of them worked. The only thing that worked was putting the underscore ("_") in front of the credsStore attribute.

This worked for me. In ~/.docker/config.json, change
{"credsStore":"desktop.exe"} to {"_credsStore":"desktop.exe"}

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

does this help? source: https://github.com/docker/for-win/issues/6652#issuecomment-633709502

I have the same issue.

All the three following solutions mentioned above remove the docker.credentials.errors.InitializationError error message:

  • Renaming credsStore to anything in ~/.docker/config.json or deleting the file altogether

  • adding the path to docker-credential-desktop.exe path to the PATH in ~/.bashrc

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

All the three solutions creates another issue, when trying to pull any image I get the following error:

ERROR: pull access denied, repository does not exist or may require 'docker login': denied: requested access to the resource is denied 

This was working for me and I decided to do the factory reset to use Buildkit instead, then I started getting this issue. The solution in https://github.com/docker/for-win/issues/6652#issuecomment-633709502 worked perfectly fine for me, but this workaround is pretty un-intuitive.

I hope once this moves into stable, this is addressed (what makes this even more un-intuitive is that none of the images are private, they are all from Docker Hub public)

I tried every potential solution above, and not of them work for me, except for adding "_" to credsStore in this file ~/.docker/config.json: {"_credsStore":"desktop.exe"}

Removing the file worked for me:
rm ~/.docker/config.json

It happens when I have my fedora native Linux on the same computer of Windows 10 and pointed out same HOME folder both on Windows and Linux

I had a similar issue after switching from edge to stable, but my error was very different. The only reason I found this thread was I noticed it would hang after looking for the auth entry. Changing the credsStore key fixed my issue but my original error message was this:

failed to create file hook: while creating logrus local file hook: unable to get 'APPDATA'

Was this page helpful?
0 / 5 - 0 ratings