Document config.json authentication

Works with the standard kaniko docker image
This commit is contained in:
Carlos Sanchez 2018-04-21 09:32:10 +02:00
parent 9e9f42fdbb
commit 4fa6c28e34
2 changed files with 26 additions and 1 deletions

View File

@ -141,7 +141,29 @@ To run kaniko in Docker, run the following command:
kaniko uses Docker credential helpers to push images to a registry.
kaniko comes with support for GCR, but configuring another credential helper should allow pushing to a different registry.
kaniko comes with support for Docker `config.json` and GCR, but configuring another credential helper should allow pushing to a different registry.
#### Pushing to Docker Hub
Get your docker registry user and password encoded in base64
echo USER:PASSWORD | base64
Create a `config.json` file with your Docker registry url and the previous generated base64 string
```
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "xxxxxxxxxxxxxxx"
}
}
}
```
Run kaniko with the `config.json` inside `/root/.docker/config.json`
docker run -ti --rm -v `pwd`:/workspace -v config.json:/root/.docker/config.json:ro gcr.io/kaniko-project/executor:latest --dockerfile=Dockerfile --destination=yourimagename
## Security

View File

@ -17,6 +17,9 @@
FROM scratch
ADD out/executor /kaniko/executor
ADD files/ca-certificates.crt /kaniko/ssl/certs/
ADD files/docker-credential-gcr /usr/local/bin/
ADD files/config.json /root/.docker/
RUN ["docker-credential-gcr", "config", "--token-source=env"]
ENV HOME /root
ENV PATH /usr/local/bin
ENV SSL_CERT_DIR=/kaniko/ssl/certs