我正在尝试执行一个简单的 docker-compose 命令。但是控制台出现错误:
Building patch-panel
Traceback (most recent call last):
File "bin/docker-compose", line 6, in <module>
File "compose/cli/main.py", line 71, in main
File "compose/cli/main.py", line 127, in perform_command
File "compose/cli/main.py", line 1080, in up
File "compose/cli/main.py", line 1076, in up
File "compose/project.py", line 475, in up
File "compose/service.py", line 358, in ensure_image_exists
File "compose/service.py", line 1082, in build
File "site-packages/docker/api/build.py", line 251, in build
File "site-packages/docker/api/build.py", line 313, in _set_auth_headers
File "site-packages/docker/auth.py", line 96, in resolve_authconfig
File "site-packages/docker/auth.py", line 127, in _resolve_authconfig_credstore
File "site-packages/dockerpycreds/store.py", line 25, in __init__
dockerpycreds.errors.InitializationError: docker-credential-gcloud not installed or not available in PATH
[4167] Failed to execute script docker-compose
我读到 pip 安装程序和 python 版本有问题。但我有两个问题。我在 WSL(Linux) 上,这有点棘手,因为解决方案中缺少步骤,而且我不熟悉 docker。我只想做一个docker-compose,但我做不到。有人能告诉我如何修复它吗?
关于我的系统的一些信息:完成后gcloud info
Google Cloud SDK [232.0.0]
Platform: [Linux, x86_64] ('Linux', 'DESKTOP-OF5642B', '4.4.0-18329-Microsoft', '#1-Microsoft Tue Jan 29 15:04:00 PST 2019', 'x86_64', '')
Python Version: [2.7.15+ (default, Nov 28 2018, 16:27:22) [GCC 8.2.0]]
Python Location: [/usr/bin/python2]
Site Packages: [Disabled]
Installation Root: [/c/Users/Efsta/AppData/Local/Google/Cloud SDK/google-cloud-sdk]
Installed Components:
docker-credential-gcr: []
core: [2019.01.27]
gsutil: [4.35]
bq: [2.0.40]
System PATH: [/home/efsta/go//bin:/usr/local/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/c/ProgramData/DockerDesktop/version-bin:/c/Program Files/Docker/Docker/Resources/bin:
/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/iCLS/:/c/Program Files/Intel/Intel(R) Management Engine Components/iCLS/:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/c/WI
NDOWS/System32/OpenSSH/:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Fil
es/Intel/Intel(R) Management Engine Components/IPT:/c/Users/Efsta/scoop/shims:/c/Users/Efsta/AppData/Local/Microsoft/WindowsApps:/c/Users/Efsta/AppData/Local/Programs/Microsoft VS Code/bin:/c/Users/Efsta/AppData/Local/Google/Cloud SDK/google-clo
ud-sdk/bin:/home/efsta/.dotnet/tools]
Python PATH: [/c/Users/Efsta/AppData/Local/Google/Cloud SDK/google-cloud-sdk/lib/third_party:/c/Users/Efsta/AppData/Local/Google/Cloud SDK/google-cloud-sdk/lib:/usr/lib/python2.7:/usr/lib/python2.7/plat-x86_64-linux-gnu:/usr/lib/python2.7/lib-tk
:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload]
Cloud SDK on PATH: [True]
Kubectl on PATH: [False]
Installation Properties: [/c/Users/Efsta/AppData/Local/Google/Cloud SDK/google-cloud-sdk/properties]
User Config Directory: [/home/efsta/.config/gcloud]
Active Configuration Name: [default]
Active Configuration Path: [/home/efsta/.config/gcloud/configurations/config_default]
Account: [[email protected]]
Project: [k8-engine]
Current Properties:
[core]
project: [k8-engine]
account: [[email protected]]
disable_usage_reporting: [True]
Logs Directory: [/home/efsta/.config/gcloud/logs]
Last Log File: [/home/efsta/.config/gcloud/logs/2019.02.04/02.22.49.856181.log]
git: [git version 2.20.1]
ssh: [OpenSSH_7.9p1 Debian-5, OpenSSL 1.1.1a 20 Nov 2018]
完成后gcloud --version
:
Google Cloud SDK 232.0.0
bq 2.0.40
core 2019.01.27
docker-credential-gcr
gsutil 4.35
Docker info
和docker compose version
:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 2
Server Version: 18.09.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9754871865f7fe2f4e74d43e2fc7ccd237edcbce
runc version: 96ec2177ae841256168fcf76954f7177af9446eb
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.125-linuxkit
Operating System: Docker for Windows
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.952GiB
Name: linuxkit-00155d010201
ID: 4TYN:GKJ7:IX2L:JZDX:IFSU:CSME:6VEU:3SRL:4LD2:NZCB:NYDL:DTUA
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 22
Goroutines: 46
System Time: 2019-02-04T00:28:06.9845313Z
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
docker-compose version 1.23.2, build 1110ad01
docker-py version: 3.6.0
CPython version: 3.6.7
OpenSSL version: OpenSSL 1.1.0f 25 May 2017
答案1
我遇到了同样的问题。删除后~/.docker/config.json
问题立即得到解决。请参见此处:https://github.com/docker/for-linux/issues/383。
答案2
打开~/.docker/config.json
并移除该credHelpers
物体就帮我修复了这个问题。
答案3
我遇到了这个问题。按照@adstwlearn的回答,我检查了~/.docker/config.json文件,发现“credHelpers”中的一个条目引用的是“gcloud”而不是“gcr”。更改它就足以解决问题,无需重新配置任何内容。
答案4
我遇到了同样的问题。我在 Ubuntu 16.04 上,并使用 apt-get 安装了 SDK,但在我写这个答案时,依赖项 docker-credential-gcr 还无法通过 apt-get 获得。
我通过从 apt-get 卸载 gcloud 并使用 Google Cloud SDK 安装程序脚本(https://cloud.google.com/sdk/docs/downloads-interactive):
curl https://sdk.cloud.google.com > install.sh
bash install.sh --disable-prompts
~/google-cloud-sdk/install.sh
然后我关闭并重新打开终端,尝试再次运行 docker-compose,它运行完美。