Document config.json authentication
Works with the standard kaniko docker image
This commit is contained in:
parent
9e9f42fdbb
commit
4fa6c28e34
24
README.md
24
README.md
|
|
@ -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 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
|
## Security
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,9 @@
|
||||||
FROM scratch
|
FROM scratch
|
||||||
ADD out/executor /kaniko/executor
|
ADD out/executor /kaniko/executor
|
||||||
ADD files/ca-certificates.crt /kaniko/ssl/certs/
|
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 HOME /root
|
||||||
ENV PATH /usr/local/bin
|
ENV PATH /usr/local/bin
|
||||||
ENV SSL_CERT_DIR=/kaniko/ssl/certs
|
ENV SSL_CERT_DIR=/kaniko/ssl/certs
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue