kubectl create secret docker-registry [page]deterministic
Create a secret for use with a Docker registry
##
Create a new secret for use with Docker registries. Dockercfg secrets are used to authenticate against Docker registries. When using the Docker command line to push images, you can authenticate to a given registry by running: '$ docker login DOCKER_REGISTRY_SERVER --username=DOCKER_USER --password=DOCKER_PASSWORD --email=DOCKER_EMAIL'. That produces a ~/.dockercfg file that is used by subsequent 'docker push' and 'docker pull' commands to authenticate to the registry. The email address is optional.
When creating applications, you may have a Docker registry that requires authentication. In order for the nodes to pull images on your behalf, they must have the credentials. You can provide this information by creating a dockercfg secret and attaching it to your service account.
``` kubectl create secret docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-file=[key=]source] [--dry-run=server|client|none] ```
##
``` # If you do not already have a .dockercfg file, create a dockercfg secret directly kubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL # Create a new secret named my-secret from ~/.docker/config.json kubectl create secret docker-registry my-secret --from-file=path/to/.docker/config.json ```
##
<table style="width: 100%; table-layout: fixed;"> <colgroup> <col span="1" style="width: 10px;" /> <col span="1" /> </colgroup> <tbody>
<tr> <td colspan="2">--allow-missing-template-keys Default: true</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.</p></td> </tr>
<tr> <td colspan="2">--append-hash</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Append a hash of the secret to its name.</p></td> </tr>
<tr> <td colspan="2">--docker-email string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Email for Docker registry</p></td> </tr>
<tr> <td colspan="2">--docker-password string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Password for Docker registry authentication</p></td> </tr>
<tr> <td colspan="2">--docker-server string Default: "https://index.docker.io/v1/"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Server location for Docker registry</p></td> </tr>
<tr> <td colspan="2">--docker-username string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Username for Docker registry authentication</p></td> </tr>
<tr> <td colspan="2">--dry-run string[="unchanged"] Default: "none"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.</p></td> </tr>
<tr> <td colspan="2">--field-manager string Default: "kubectl-create"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Name of the manager used to track field ownership.</p></td> </tr>
<tr> <td colspan="2">--from-file strings</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Key files can be specified using their file path, in which case a default name of .dockerconfigjson will be given to them, or optionally with a name and file path, in which case the given name will be used. Specifying a directory will iter …(trimmed)