Skip to content

Commit 24b3a6d

Browse files
committed
Add README for docker-credential-mmds
Signed-off-by: Kern Walster <[email protected]>
1 parent b9404d0 commit 24b3a6d

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

docker-credential-mmds/README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Docker Credential Helper MMDS
2+
3+
Docker Credential Helper MMDS is a [credential helper](https://github.com/docker/docker-credential-helpers) for exposing docker credentials inside a [Firecracker microVM](https://github.com/firecracker-microvm/firecracker) via [MMDS](https://github.com/firecracker-microvm/firecracker/blob/main/docs/mmds/mmds-user-guide.md).
4+
5+
# Building
6+
7+
`docker-credential-mmds` can built with
8+
```
9+
make
10+
```
11+
12+
# Configuration
13+
14+
## Docker inside Firecracker
15+
When building a firecracker rootfs, place `docker-credential-mmds` on the `PATH` then put the following configuration in `~/.docker/config`
16+
17+
```
18+
{
19+
"credsStore": "mmds"
20+
}
21+
```
22+
23+
This configures the Docker daemon running inside the Firecracker microVM to read all credentials from MMDS.
24+
25+
## Credentials from Host
26+
27+
`docker-credential-mmds` reads credentials from MMDS inside the Firecracker microVM, but a cooperating process on the host needs to place credentials into MMDS. The credentials must be placed in MMDS under a key called `docker-credentials` which contains maps of host names to `username` and `password`.
28+
29+
For example, the following configures credentials for the ECR public gallery and docker hub
30+
```
31+
{
32+
"docker-credentials": {
33+
"public.ecr.aws": {
34+
"username": "123456789012",
35+
"password": "access_key"
36+
},
37+
"docker.io": {
38+
"username": "user",
39+
"password": "pass"
40+
}
41+
}
42+
}
43+
```
44+
45+
### Placing credentials with the Firecracker HTTP API
46+
One way to put credentials into MMDS is with firecracker's HTTP API.
47+
48+
```
49+
curl --unix-socket /tmp/firecracker.socket -i \
50+
-X PUT "http://localhost/mmds" \
51+
-H "Content-Type: application/json" \
52+
-d '{
53+
"docker-credentials": {
54+
"public.ecr.aws": {
55+
"username": "123456789012",
56+
"password": "access_key"
57+
},
58+
"docker.io": {
59+
"username": "user",
60+
"password": "pass"
61+
}
62+
}
63+
}'
64+
```
65+
66+
### Placing credentials with the Firecracker-go-sdk
67+
For larger systems, it may be useful to write a full program on the host to enable additional features such as credential refreshing. The [firecracker-go-sdk](https://github.com/firecracker-microvm/firecracker-go-sdk) wraps the firecracker HTTP APIs with go APIs for this purpose.
68+
69+
```
70+
credentials := `{
71+
"docker-credentials": {
72+
"public.ecr.aws": {
73+
"username": "123456789012",
74+
"password": "access_key"
75+
},
76+
"docker.io": {
77+
"username": "user",
78+
"password": "pass
79+
}
80+
}
81+
}`
82+
fcClient, _ := client.New("/tmp/firecracker.socket")
83+
fcClient.SetVMMetadata(ctx, &proto.SetVMMetadataRequest{
84+
VMID: vmID,
85+
Metadata: credentials,
86+
})
87+
```

0 commit comments

Comments
 (0)