写在前边
今天学习发布一个Docker镜像包,到了 docker login
环节抛了一个warning
显而易见,密码存储不安全,建议我们配置一个凭据帮助程序来存储。说干就干,Just do it
1 | https://docs.docker.com/engine/reference/commandline/login/#credentials-store |
1 | https://github.com/docker/docker-credential-helpers |
注意 README
中有一段话
Note
pass needs to be configured for docker-credential-pass to work properly. It must be initialized with a gpg2 key ID. Make sure your GPG key exists is in gpg2 keyring as pass uses gpg2 instead of the regular gpg.
OK.了解,在 Linux
下边,需要配置一下 pass
。这就是我们需要的工具,接下来进入正式的安装和配置。
Manjaro
中的 docker-credential-pass
安装使用
Install pass
1 | yay -S pass |
Download docker-credential-pass
1 | wget https://github.com/docker/docker-credential-helpers/releases/download/v0.6.0/docker-credential-pass-v0.6.0-amd64.tar.gz |
Install docker-credential-pass
1 | chmod +x docker-credential-pass |
Create a new gpg2 key
1 | $ gpg2 --gen-key |
Initialize pass using the newly created key
1 | pass init "<Your Name>" |
配置你的 config
Add credsStore to your docker config. This can be done with
sed
if you don’t already have credStore added to your config or you can manually add “credStore”:”pass” to the config.json.
1 | sed -i '0,/{/s/{/{\n\t"credsStore": "pass",/' ~/.docker/config.json |
Login to docker
1 | $ docker login |
搞定,结束。
End
Happy Coding,继续生产 BUG
吧
Bye~