docker_credentials
Creates, updates, deletes, gets or lists a docker_credentials
resource.
Overview
Name | docker_credentials |
Type | Resource |
Id | digitalocean.container_registry.docker_credentials |
Fields
The following fields are returned by SELECT
queries:
- registries_get_docker_credentials
A Docker config.json
file for the container registry.
Name | Datatype | Description |
---|---|---|
registry.digitalocean.com | object |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
registries_get_docker_credentials | select | registry_name | In order to access your container registry with the Docker client or from a Kubernetes cluster, you will need to configure authentication. The necessary JSON configuration can be retrieved by sending a GET request to /v2/registries/{registry_name}/docker-credentials .The response will be in the format of a Docker config.json file. To use theconfig in your Kubernetes cluster, create a Secret with: kubectl create secret generic docr <br /> --from-file=.dockerconfigjson=config.json <br /> --type=kubernetes.io/dockerconfigjson By default, the returned credentials have read-only access to your registry and cannot be used to push images. This is appropriate for most Kubernetes clusters. To retrieve read/write credentials, suitable for use with the Docker client or in a CI system, read_write may be provided as query parameter. For example: /v2/registries/{registry_name}/docker-credentials?read_write=true By default, the returned credentials will not expire. To retrieve credentials with an expiry set, expiry_seconds may be provided as a query parameter. For example: /v2/registries/{registry_name}/docker-credentials?expiry_seconds=3600 will returncredentials that expire after one hour. | |
registry_get_docker_credentials_legacy | exec | expiry_seconds , read_write | In order to access your container registry with the Docker client or from a Kubernetes cluster, you will need to configure authentication. The necessary JSON configuration can be retrieved by sending a GET request to /v2/registry/docker-credentials .The response will be in the format of a Docker config.json file. To use theconfig in your Kubernetes cluster, create a Secret with: kubectl create secret generic docr <br /> --from-file=.dockerconfigjson=config.json <br /> --type=kubernetes.io/dockerconfigjson By default, the returned credentials have read-only access to your registry and cannot be used to push images. This is appropriate for most Kubernetes clusters. To retrieve read/write credentials, suitable for use with the Docker client or in a CI system, read_write may be provided as query parameter. For example: /v2/registry/docker-credentials?read_write=true By default, the returned credentials will not expire. To retrieve credentials with an expiry set, expiry_seconds may be provided as a query parameter. For example: /v2/registry/docker-credentials?expiry_seconds=3600 will returncredentials that expire after one hour. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
registry_name | string | The name of a container registry. (example: example) |
expiry_seconds | integer | The duration in seconds that the returned registry credentials will be valid. If not set or 0, the credentials will not expire. (example: 3600) |
read_write | boolean | By default, the registry credentials allow for read-only access. Set this query parameter to true to obtain read-write credentials. (example: true) |
SELECT
examples
- registries_get_docker_credentials
In order to access your container registry with the Docker client or from a
Kubernetes cluster, you will need to configure authentication. The necessary
JSON configuration can be retrieved by sending a GET request to/v2/registries/{registry_name}/docker-credentials
.
The response will be in the format of a Docker config.json
file. To use the
config in your Kubernetes cluster, create a Secret with:
kubectl create secret generic docr <br /> --from-file=.dockerconfigjson=config.json <br /> --type=kubernetes.io/dockerconfigjson
By default, the returned credentials have read-only access to your registry
and cannot be used to push images. This is appropriate for most Kubernetes
clusters. To retrieve read/write credentials, suitable for use with the Docker
client or in a CI system, read_write may be provided as query parameter. For
example: /v2/registries/{registry_name}/docker-credentials?read_write=true
By default, the returned credentials will not expire. To retrieve credentials
with an expiry set, expiry_seconds may be provided as a query parameter. For
example: /v2/registries/{registry_name}/docker-credentials?expiry_seconds=3600
will return
credentials that expire after one hour.
SELECT
registry.digitalocean.com
FROM digitalocean.container_registry.docker_credentials
WHERE registry_name = '{{ registry_name }}' -- required;
Lifecycle Methods
- registry_get_docker_credentials_legacy
In order to access your container registry with the Docker client or from a
Kubernetes cluster, you will need to configure authentication. The necessary
JSON configuration can be retrieved by sending a GET request to/v2/registry/docker-credentials
.
The response will be in the format of a Docker config.json
file. To use the
config in your Kubernetes cluster, create a Secret with:
kubectl create secret generic docr <br /> --from-file=.dockerconfigjson=config.json <br /> --type=kubernetes.io/dockerconfigjson
By default, the returned credentials have read-only access to your registry
and cannot be used to push images. This is appropriate for most Kubernetes
clusters. To retrieve read/write credentials, suitable for use with the Docker
client or in a CI system, read_write may be provided as query parameter. For
example: /v2/registry/docker-credentials?read_write=true
By default, the returned credentials will not expire. To retrieve credentials
with an expiry set, expiry_seconds may be provided as a query parameter. For
example: /v2/registry/docker-credentials?expiry_seconds=3600
will return
credentials that expire after one hour.
EXEC digitalocean.container_registry.docker_credentials.registry_get_docker_credentials_legacy
@expiry_seconds='{{ expiry_seconds }}',
@read_write={{ read_write }};