Create Registry Token
This section shows you how to create a registry token. We assume the following prerequisite:
In this guide, we used test named repository to create registry tokens. Therefore, it is important that the you know your container registry name.
With the
POST
request, you get the registry token. You will need to provide registry ID:Note: The sample
requestID
is 789f8e3c-d5c8-4359-8f85-c200fb89e97ccurl --location \
--request POST 'https://api.ionos.com/containerregistries/registries/:789f8e3c-d5c8-4359-8f85-c200fb89e97c/tokens' \
--header 'Authorization: Basic am9obkBleGFtcGxlLmNvbTphYmMxMjM=' \
--header 'Content-Type: application/json' \
--data-raw '{
"properties": {
"name": "test",
"expiryDate": null,
"scopes": [
{
"name": "*",
"actions": [
"pull", "push", "delete"
],
"type": "repository"
}
]
}
}'
200 OK - Successfully showed the list of registries
{
"id": "8fb592e4-494c-11ed-b878-0242ac120002",
"type": "token",
"href": "",
"metadata": {
"createdBy": "[email protected]",
"createdByUserId": "8hb792e4-494c-11ed-b878-0242ac120002",
"createdDate": "2022-10-08T15:56:04Z",
"state": "enabled"
},
"properties": {
"name": "test",
"scopes": [
{
"actions": [
"pull",
"push",
"delete"
],
"name": "*",
"type": "repository"
}
],
"expiryDate": null,
"status": "enabled",
"credentials": {
"username": "test",
"password": "148g592e4-494c-11ed-b878-0242ac120002"
}
}
}
Field | Type | Description | Example |
---|---|---|---|
id | string | The id of the created token. | 8fb592e4-494c-11ed-b878-0242ac120002 |
createdBy | string | The user who created the token. | |
createdByUserId | string | The ID of the user or service account that initiated the operation. | 8fb59000-494c-11ed-0242ac120002 |
state | string | The status of the registry. | Running |
hostname | string | The allocated hostname for the particular registry. | demo.cr.de-fra.test.com |
Note:
- Your values will differ from those in the sample code. Your response will have a different
id
for your token.
409 - Conflict
{
"httpStatus": 409,
"messages": [
{
"errorCode": "0",
"message": "already exists: name is not available"
}
]
}
If you want to push your local images to docker repository, you need to login to it using:
docker login [OPTIONS] [SERVER]
You need to enter the following options to login:
- Hostname
- Username
- Password
You can push the images to your registry by providing all required information. You can query registries and look at images manifest, discover tags, delete layers and delete manifest etc. In the Docker API calls:
- You can use the name of registry
- Authenticate the API calls with a token
To know more, explore the Docker Documentation. On the other hand, DCD uses an easy to opt passthrough feature which as discussed uses Basic Auth feature, so you dont need to use a separate authentication method for Data Center Designer (DCD).
Last modified 11mo ago