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

Windows docker fails to use build function of docker-compose #7273

Closed
Jn58 opened this issue Mar 7, 2020 · 20 comments
Closed

Windows docker fails to use build function of docker-compose #7273

Jn58 opened this issue Mar 7, 2020 · 20 comments

Comments

@Jn58
Copy link

Jn58 commented Mar 7, 2020

Description of the issue

Errors about credential occurs on build within docker-compose.yml on Windows.

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.25.4, build 8d51620a
docker-py version: 4.1.0
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.1c  28 May 2019

Output of docker version

Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea
 Built:             Wed Nov 13 07:22:37 2019
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.5
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.12
  Git commit:       633a0ea
  Built:            Wed Nov 13 07:29:19 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

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

services:
  redis:
    image: redis:alpine
  web:
    build:
      context: C:\Users\cacog\OneDrive\Documents\composetest
    ports:
    - 5000:5000/tcp
version: '3.0'

Steps to reproduce the issue

  1. Follow Step 1 to Step 4 of Get started with Docker Compose

Observed result

docker-compose up of Step 4 fails to build.

Expected result

Successfull docker-compose up.

Stacktrace / full error message

Building web
Traceback (most recent call last):
  File "site-packages\docker\credentials\store.py", line 80, in _execute
  File "subprocess.py", line 395, in check_output
  File "subprocess.py", line 487, in run
subprocess.CalledProcessError: Command '['C:\\Program Files\\Docker\\Docker\\resources\\bin\\docker-credential-desktop.EXE', 'list']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "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 302, in get_all_credentials
  File "site-packages\docker\credentials\store.py", line 71, in list
  File "site-packages\docker\credentials\store.py", line 93, in _execute
docker.credentials.errors.StoreError: Credentials store docker-credential-desktop exited with "error listing credentials - err: exit status 1, out: `A specified logon session does not exist. It may alrea
dy have been terminated.`".
[2780] Failed to execute script docker-compose

Additional information

OS version

  • Edition : Windows 10 Pro
  • Version : 1903
  • OS build : 18362.657

docker-compose install method

docker-compose is installed with official installer of docker.

@Jn58 Jn58 added the kind/bug label Mar 7, 2020
@Jn58
Copy link
Author

Jn58 commented Mar 8, 2020

I find that this error only occurs over ssh.
I'm using ssh server on windows, Win32 OpneSSH and when I use docker-compose build over ssh, above error occurs.
However, when I try docker build (not docker-compose build) over ssh, it works well. So I think it's still a problem of docker-compose and I'll leave this issue opened.

@Hooch76
Copy link

Hooch76 commented Mar 10, 2020

Same here: docker and docker-compose versions are exactly the same, but running on WIndows 10 1909 (18363.418).
The error also does occur when sitting right in front of the system (so not ssh'ing into Windows). Deleting %userprofile%.docker\config.json solves the problem and docker-compose pull runs without any errors. But config.json gets recreated after some time.

@Jn58
Copy link
Author

Jn58 commented Mar 10, 2020

Same here: docker and docker-compose versions are exactly the same, but running on WIndows 10 1909 (18363.418).
The error also does occur when sitting right in front of the system (so not ssh'ing into Windows). Deleting %userprofile%.docker\config.json solves the problem and docker-compose pull runs without any errors. But config.json gets recreated after some time.

I tried this solution, but still have error over ssh.

@Hooch76
Copy link

Hooch76 commented Mar 10, 2020

Try renaming the file instead of deleting it. The file will get re-created almost immediately after it is deleted. Renaming it (config.bla or whatever) gives you some extra seconds until it is also recreated.

@Jn58
Copy link
Author

Jn58 commented Mar 10, 2020

@Hooch76 Thank you for advice, but even I change file name with mv command and retry, it shows same error.

@paulspartan14
Copy link

It happens to me when I use git bash, when I run the command on the windows cmd this problem does not happen

@IamGroot19
Copy link

IamGroot19 commented Sep 15, 2020

It happens to me when I use git bash, when I run the command on the windows cmd this problem does not happen.

FWIW I can confirm the same issue. I am using Docker desktop on Windows 10 Home Single Language (version 2004, OS Build 19041.508 ) with WSL2.
Here's the output of docker-compose up on Git Bash. (But if i run the docker-compose up on Windows command prompt it seems to be working fine)

 Traceback (most recent call last):
  File "site-packages\docker\credentials\store.py", line 80, in _execute
  File "subprocess.py", line 395, in check_output
  File "subprocess.py", line 487, 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 "site-packages\docker\auth.py", line 264, in _resolve_authconfig_credstore
  File "site-packages\docker\credentials\store.py", line 35, in get
  File "site-packages\docker\credentials\store.py", line 93, in _execute
docker.credentials.errors.StoreError: Credentials store docker-credential-desktop exited with "error getting credentials - err: exec: "docker-credential-wincred.exe": executable file not found in %PATH%, out: ``".

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "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 1078, in up
  File "compose\cli\main.py", line 1074, in up
  File "compose\project.py", line 548, in up
  File "compose\service.py", line 361, in ensure_image_exists
  File "compose\service.py", line 1250, in pull
  File "compose\progress_stream.py", line 102, in get_digest_from_pull
  File "compose\service.py", line 1215, in _do_pull
  File "site-packages\docker\api\image.py", line 396, in pull
  File "site-packages\docker\auth.py", line 48, in get_config_header
  File "site-packages\docker\auth.py", line 324, in resolve_authconfig
  File "site-packages\docker\auth.py", line 235, in resolve_authconfig
  File "site-packages\docker\auth.py", line 281, in _resolve_authconfig_credstore
docker.errors.DockerException: Credentials store error: StoreError('Credentials store docker-credential-desktop exited with "error getting credentials - err: exec: "docker-credential-wincred.exe": executable file not foundial-wincred.exe": executable file not found in %PATH%, out: ``".')
[13052] Failed to execute script docker-compose

For more info about the docker version I am using is the output of docker version command from command prompt:

Client: Docker Engine - Community
Version: 19.03.12
API version: 1.40
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:43:18 2020
OS/Arch: windows/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 19.03.12
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:49:27 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

Thanks

@markoueis
Copy link

markoueis commented Oct 20, 2020

Hey guys we are having the same issue. Any progress on this or workarounds. We too see it happening more over ssh (we have jenkins ssh-ing in and calling it) though I think we reproduced it once without (can't confirm for sure it was exactly the same thing).

It seems intermittent so can't always tell if deleting the file is helping or not

Using docker desktop 2.4.0.0 (48506)

[4480] Failed to execute script docker-compose
Traceback (most recent call last):
  File "site-packages\docker\credentials\store.py", line 80, in _execute
  File "subprocess.py", line 395, in check_output
  File "subprocess.py", line 487, in run
subprocess.CalledProcessError: Command '['C:\\Program Files\\Docker\\Docker\\resources\\bin\\docker-credential-wincred.EXE', 'get']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\docker\auth.py", line 264, in _resolve_authconfig_credstore
  File "site-packages\docker\credentials\store.py", line 35, in get
  File "site-packages\docker\credentials\store.py", line 93, in _execute
docker.credentials.errors.StoreError: Credentials store docker-credential-wincred exited with "A specified logon session does not exist. It may already have been terminated.".

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  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 "site-packages\docker\api\image.py", line 396, in pull
  File "site-packages\docker\auth.py", line 48, in get_config_header
  File "site-packages\docker\auth.py", line 324, in resolve_authconfig
  File "site-packages\docker\auth.py", line 235, in resolve_authconfig
  File "site-packages\docker\auth.py", line 281, in _resolve_authconfig_credstore
docker.errors.DockerException: Credentials store error: StoreError('Credentials store docker-credential-wincred exited with "A specified logon session does not exist. It may already have been 
terminated.".')

@luisegarduno
Copy link

luisegarduno commented Nov 24, 2020

Possible work around , After SSH'ing into your guest (linux) run the following commands :

$ sudo su
$ docker-compose up

Edit: ^ I forgot to specify that this solution was performed within a WSL2 environment on Windows 10.

@Jn58
Copy link
Author

Jn58 commented Nov 27, 2020

Possible work around , After SSH'ing into your guest (linux) run the following commands :

$ sudo su
$ docker-compose up

@luisegarduno
In this issue, we are talking about docker running on Windows. Not linux.

@slikts
Copy link

slikts commented Dec 25, 2020

@Jn58 The sudo workaround helped on Windows using WSL2. I'm ssh-ing into a Windows machine that runs WSL2 and using bash as the shell, and docker-compose up would not work without elevated privileges.

@bjanders
Copy link

bjanders commented Feb 1, 2021

I had the same issue in WSL2. docker-compose up worked, but I got the error when I ran docker compose up --build. Running it as sudo docker compose up --build works. Previously I have run it succesfully in WSL2 without the need for sudo.

I'm running Docker desktop 3.1.0.

Update: After rebooting Windows, --build without sudo works again. I did not test just restarting WSL.

@Paul9321Appsoftware
Copy link

Try renaming the file instead of deleting it. The file will get re-created almost immediately after it is deleted. Renaming it (config.bla or whatever) gives you some extra seconds until it is also recreated.

Thanks, that worked for me.

@MoDReD
Copy link

MoDReD commented Feb 17, 2021

i have the same issue

@MoDReD
Copy link

MoDReD commented Feb 17, 2021

@Jn58 you found a solution ?

@MoDReD
Copy link

MoDReD commented Feb 17, 2021

Solution:
add environment
COMPOSE_DOCKER_CLI_BUILD=1

@nalmeida84
Copy link

That works on Windows? (WSL2)

@stale
Copy link

stale bot commented Aug 28, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 28, 2021
@stale
Copy link

stale bot commented Sep 7, 2021

This issue has been automatically closed because it had not recent activity during the stale period.

@stale stale bot closed this as completed Sep 7, 2021
@LongBeachHXC
Copy link

Solution: add environment COMPOSE_DOCKER_CLI_BUILD=1

I can confirm the workaround above works great. Doing the sudo su workaround also worked for me but this one is better since we don't need to switch into root.

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