To run Docker directly on WSL2 without using Docker desktop I followed different sources. The steps I performed are very similar to those describe here: https://dev.to/felipecrs/simply-run-docker-on-wsl2-3o8. Docker works, but I still had to configured a credential store so a docker login would work. I tried two approaches:
A) I tried to use pass as credential store following https://github.com/docker/docker-credential-helpers/issues/102#issuecomment-388974092
'docker login'.... Login Succeeded. The auths were added to .docker/config.json, where the credsStore was set to 'pass'. However, after the successful docker login, the pull command still fails with an authentication error: Error response from daemon: unauthorized: unauthorized to access repository:...
It seems like the token is not used for the subsequent command anymore.
B) Trying a less desirable approach, I switched to configuring wincred.exe as credsStore
~/.docker/config.json
{
"credsStore": "wincred.exe"
}
as shown in the Bonus section at the bottom here: 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
This approach works, but strangely every login or pull takes > 1min before the authentication passes successfully and the operation starts.
I would prefer to have a clean Linux-only approach similar to A, but would also be grateful for an explanation / solution to the remaining issue with B.