Short answer
the command docker-credentials-osxkeychain get reads from standard input and expects server url as described here
so one can do something like
$ echo "https://index.docker.io/v1/" | docker-credential-osxkeychain get
You can find the server url using docker-credential-osxkeychain list
$ docker-credential-osxkeychain list
{"https://index.docker.io/v1/":"someuser"}
Long answer
First, you might want to change credsStore to osxkeychain which makes ~/.docker/config.json look like
{
"stackOrchestrator" : "swarm",
"credsStore" : "osxkeychain",
"auths" : {
},
"experimental" : "disabled"
}
Second, login with docker cli using docker login
$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: someuser
Password:
Login Succeeded
On successful login, docker-credential-osxkeychain has stored the username and password in osxkeychain which can be retrieved using docker-credential-osxkeychain get
$ docker-credential-osxkeychain list
{"https://index.docker.io/v1/":"someuser"}
we can use the url as the key to get our credentials
note: docker-credential-osxkeychain get uses stdin to read the input.
$ echo "https://index.docker.io/v1/" | docker-credential-osxkeychain get
{"ServerURL":"https://index.docker.io/v1/","Username":"someuser","Secret":"your-actual-password"}