Setting up authentication with docker repo via ssh cert for single user

Viewed 23

It's possible to authenticate with a docker repo automatically using rsa certificates as described here.

However, this sets up this authentication for all users. This is a problem because I have personal certificates I want to use to authenticate with from my account only. If I followed the steps above then anyone who happened to be using the same VM would automatically authenticate with docker as me, which I don't want.

So how can I configure docker so I get the same convenience of automatic authentication with my cert without risking someone else on the machine accidentally using the same certs to authenticate?

1 Answers

Podman can do this trick: https://docs.podman.io/en/latest/markdown/podman-login.1.html

--cert-dir=path

Use certificates at path (*.crt, *.cert, *.key) to connect to the registry. (Default: /etc/containers/certs.d) Please refer to containers-certs.d(5) for details. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines)

$ podman login --cert-dir /home/myuser/certs.d/ -u foo -p bar localhost:5000
Login Succeeded!
Related