【发布时间】:2021-11-02 10:35:06
【问题描述】:
为了不使用 Docker 桌面直接在 WSL2 上运行 Docker,我遵循了不同的来源。我执行的步骤与此处描述的步骤非常相似:https://dev.to/felipecrs/simply-run-docker-on-wsl2-3o8。 Docker 可以工作,但我仍然必须配置一个凭证存储,这样 docker 登录才能工作。我尝试了两种方法:
A) 我尝试在https://github.com/docker/docker-credential-helpers/issues/102#issuecomment-388974092 之后使用 pass as credential store
'泊坞窗登录'....Login Succeeded。身份验证已添加到 .docker/config.json,其中 credsStore 设置为“pass”。但是,docker登录成功后,pull命令仍然失败并出现认证错误:Error response from daemon: unauthorized: unauthorized to access repository:...
似乎令牌不再用于后续命令。
B) 尝试了一种不太理想的方法,我转而将 wincred.exe 配置为 credsStore
~/.docker/config.json
{
"credsStore": "wincred.exe"
}
如底部的奖励部分所示:https://dev.to/felipecrs/simply-run-docker-on-wsl2-3o8:
wincred_version=$(curl -fsSL -o /dev/null -w "%{url_effective}" https://github.com/docker/docker-credential-helpers/releases/latest | xargs basename)
sudo curl -fL "https://github.com/docker/docker-credential-helpers/releases/download/${wincred_version}/docker-credential-wincred-${wincred_version}-$(dpkg
--print-architecture).zip" | zcat | sudo tee /usr/local/bin/docker-credential-wincred.exe >/dev/null
sudo chmod +x /usr/local/bin/docker-credential-wincred.exe
这种方法有效,但奇怪的是,每次登录或拉取都需要超过 1 分钟才能成功通过身份验证并开始操作。
我希望有一个类似于 A 的干净的纯 Linux 方法,但也希望能对 B 的剩余问题提供解释/解决方案。
【问题讨论】:
-
wincred_version=$(curl -fsSL -o /dev/null -w "%{url_effective}" github.com/docker/docker-credential-helpers/releases/latest | xargs 基本名称) sudo curl -fL \ "github.com/docker/docker-credential-helpers/releases/download/${wincred_version}/docker -credential-wincred-${wincred_version}-$(dpkg --print-architecture).zip" |猫猫 | sudo tee /usr/local/bin/docker-credential-wincred.exe >/dev/null sudo chmod +x /usr/local/bin/docker-credential-wincred.exe