This skill provides lifecycle management capabilities for Huawei Cloud SWR (Software Repository for Container) images using the hcloud CLI.
Architecture: hcloud CLI → SWR Service API → Namespace/Repository/Tag/Auth/Quota resources
Related Skills:
huawei-cloud-swr-image-governance - Image governance (permissions, retention, sharing, tags, immutable rules)
huawei-cloud-swr-image-automation - Image automation ops (sync, triggers, domains)
huawei-cloud-swr-enterprise-instance - Enterprise instance management
Create and manage SWR namespaces (organizations)
Create and manage image repositories with public/private settings
Query and manage image tags/versions
Obtain docker login credentials (temporary and long-term)
Check SWR resource quotas
Typical Use Cases:
hcloud version to verify installationprintf "y\n" | hcloud version to accept privacy statementValid Huawei Cloud credentials (AK/SK mode)
Security Rules:
echo $HUAWEI_CLOUD_AK or echo $HUAWEI_CLOUD_SK to check credentialsHUAWEI_CLOUD_AK, HUAWEI_CLOUD_SK, HUAWEI_CLOUD_REGIONConfiguration Method (Environment Variables Only):
bash
export HUAWEI_CLOUD_AK=<your-ak>
export HUAWEI_CLOUD_SK=<your-sk>
export HUAWEI_CLOUD_REGION=cn-north-4
⚠️ Important Security Notes:
API ActionPermissionPurposeswr:namespace:createCreate namespaceCreate SWR organizationsswr:namespace:listList namespacesQuery all namespacesswr:namespace:getGet namespaceView individual namespace informationswr:namespace:deleteDelete namespaceRemove organizationsswr:repository:createCreate repoCreate image repositoriesswr:repository:listList reposQuery image repositoriesswr:repository:getGet repoView repository detailsswr:repository:updateUpdate repoModify repository propertiesswr:repository:deleteDelete repoRemove image repositoriesswr:tag:listList tagsQuery image tags/versionsswr:tag:getGet tagView specific tag detailsswr:tag:createCreate tagCreate image tagswr:tag:deleteDelete tagRemove image tagswr:login:getGet login tokenObtain docker login credentialsswr:quota:getGet quotaCheck resource quotas
See IAM Permission Policies for complete policy JSON.
Permission Failure Handling:
references/iam-policies.mdSee Task: Namespace Management for detailed workflows.
bash
# List all namespaces
hcloud SWR ListNamespaces --cli-region=cn-north-4
# List namespaces with filter
hcloud SWR ListNamespaces --filter="namespace::group-dev|mode::visible" --cli-region=cn-north-4
# Show namespace details
hcloud SWR ShowNamespace --namespace=group-dev --cli-region=cn-north-4
# Create a namespace
hcloud SWR CreateNamespace --namespace=group-dev --cli-region=cn-north-4
# Delete a namespace (CAUTION: removes all repos under it)
hcloud SWR DeleteNamespaces --namespace=group-dev --cli-region=cn-north-4
Namespace Naming Rules:
See Task: Repository Management for detailed workflows.
bash
# List all repositories
hcloud SWR ListReposDetails --cli-region=cn-north-4
# List repositories in a namespace
hcloud SWR ListReposDetails --namespace=group-dev --cli-region=cn-north-4
# List repositories with pagination and sorting
hcloud SWR ListReposDetails --namespace=group-dev --limit=20 --offset=0 --order_column=updated_at --order_type=desc --cli-region=cn-north-4
# List repositories by category
hcloud SWR ListReposDetails --category=database --cli-region=cn-north-4
# Show repository details
hcloud SWR ShowRepository --namespace=group-dev --repository=nginx --cli-region=cn-north-4
# Create a repository
hcloud SWR CreateRepo --namespace=group-dev --repository=my-app --is_public=false --category=other --description="Custom app image" --cli-region=cn-north-4
# Update repository (change visibility, description, category)
hcloud SWR UpdateRepo --namespace=group-dev --repository=my-app --is_public=true --description="Updated description" --cli-region=cn-north-4
# Delete a repository (CAUTION: removes all image tags)
hcloud SWR DeleteRepo --namespace=group-dev --repository=my-app --cli-region=cn-north-4
Repository Naming Rules:
Repository Categories: app_server, linux, framework_app, database, lang, other, windows, arm
See Task: Tag Management for detailed workflows.
bash
# List all tags in a repository
hcloud SWR ListRepositoryTags --namespace=group-dev --repository=nginx --cli-region=cn-north-4
# List tags with pagination and sorting
hcloud SWR ListRepositoryTags --namespace=group-dev --repository=nginx --limit=50 --offset=0 --order_column=updated_at --order_type=desc --cli-region=cn-north-4
# Search for a specific tag
hcloud SWR ListRepositoryTags --namespace=group-dev --repository=nginx --filter="tag::v1.0" --cli-region=cn-north-4
# Show tag details (image digest, size, create time)
hcloud SWR ShowRepoTag --namespace=group-dev --repository=nginx --tag=v1.0 --cli-region=cn-north-4
# Create a tag (retag existing image)
hcloud SWR CreateRepoTag --namespace=group-dev --repository=nginx --source_tag=v1.0 --destination_tag=v1.0-stable --override=false --cli-region=cn-north-4
# Delete a tag (CAUTION: removes the image version permanently)
hcloud SWR DeleteRepoTag --namespace=group-dev --repository=nginx --tag=v1.0-old --cli-region=cn-north-4
See Task: Auth Management for detailed workflows.
bash
# Get temporary docker login credentials (valid for 12 hours)
hcloud SWR CreateAuthorizationToken --cli-region=cn-north-4
# Get long-term docker login credentials (valid for 1 year)
hcloud SWR CreateSecret --cli-region=cn-north-4
Response Format (verified against actual API):
The response returns a Docker auth config object:
json
{
"auths": {
"swr.cn-north-4.myhuaweicloud.com": {
"auth": "base64-encoded-auth-token"
}
}
}
auths: Docker config auth object, registry host as keyauth: Base64-encoded username:password stringDocker Login Command:
bash
# Decode auth field: echo <auth_value> | base64 -d → username:password
docker login -u <decoded_username> -p <decoded_password> swr.cn-north-4.myhuaweicloud.com
See Task: Quota Management for detailed workflows.
bash
# Check SWR quotas
hcloud SWR ListQuotas --cli-region=cn-north-4
ParameterRequired/OptionalDescriptionDefault--cli-regionRequiredHuawei Cloud region IDConfig value or HUAWEI_CLOUD_REGION``--namespaceContext-dependentSWR namespace (organization)N/A--repositoryContext-dependentImage repository nameN/A--tagContext-dependentImage tag/version nameN/A
ParameterRequiredDescriptionConstraints--namespaceYesNamespace name1-64 chars, lowercase start, specific rules--filterNoFilter by name/mode`namespace::{name}
ParameterRequiredDescriptionConstraints--namespaceYesNamespace nameSee naming rules--repositoryYesRepository nameSee naming rules--is_publicYesPublic/privatetrue or false``--categoryNoRepository categorySee category list--descriptionNoRepository descriptionFree text--limitNoPage sizeMax 1000, default 100--offsetNoPage offsetMust pair with --limit``--order_columnNoSort columnname, updated_time, tag_count (note: tag_count is the param value even though response field is num_images)--order_typeNoSort directiondesc (descending), asc (ascending)--nameNoSearch by name (fuzzy)Partial match
ParameterRequiredDescriptionConstraints--namespaceYesNamespace nameSee naming rules--repositoryYesRepository nameSee naming rules--tagYesTag/version nameFree text--source_tagYesSource tag (for create)Existing tag name--destination_tagYesTarget tag (for create)New tag name--overrideNoOverwrite existing tagtrue or false
json
{
"namespaces": [
{
"id": 3827347,
"name": "group-dev",
"creator_name": "user-name",
"auth": 7,
"access_user_count": 1,
"repo_count": 2
}
]
}
Response is a flat JSON array (not wrapped in an object):
json
[
{
"name": "nginx",
"category": "app_server",
"description": "Nginx web server",
"size": 268435456,
"is_public": true,
"num_images": 5,
"num_download": 120,
"path": "swr.cn-north-4.myhuaweicloud.com/group-dev/nginx",
"internal_path": "swr.cn-north-4.myhuaweicloud.com/group-dev/nginx",
"namespace": "group-dev",
"domain_name": "user-name",
"tags": ["v1.0", "v1.1", "latest"],
"created_at": "2026-04-15T10:30:00Z",
"updated_at": "2026-05-20T14:20:00Z",
"logo": "",
"url": "",
"status": false,
"total_range": 2
}
]
Note: num_images is the tag count (not tag_count). tags is an array of tag name strings included directly in the repository listing.
Response is a flat JSON array (not wrapped in an object):
json
[
{
"id": 32962315,
"repo_id": 3374895,
"Tag": "v1.0",
"image_id": "f47c82866a20...",
"digest": "sha256:c8cede14b121...",
"schema": 2,
"size": 134217728,
"path": "swr.cn-north-4.myhuaweicloud.com/group-dev/nginx:v1.0",
"internal_path": "swr.cn-north-4.myhuaweicloud.com/group-dev/nginx:v1.0",
"is_trusted": false,
"created": "2026-04-15T10:30:00Z",
"updated": "2026-05-20T14:20:00Z",
"domain_id": "xxx",
"scanned": false,
"tag_type": 0
}
]
Note: Tag name field is Tag (capital T), timestamps use created/ updated (not created_at/ updated_at).
json
{
"id": 3374887,
"ns_id": 3827347,
"name": "nginx",
"category": "other",
"creator_id": "05949eb5...",
"creator_name": "user-name",
"num_images": 17,
"num_download": 35,
"is_public": false,
"path": "swr.cn-north-4.myhuaweicloud.com/group-dev/nginx",
"created": "2026-03-26T07:42:40Z",
"updated": "2026-05-06T09:22:11Z",
"domain_id": "05949eb4...",
"priority": 0
}
Note: ShowRepository uses created/ updated and num_images — different from ListReposDetails which uses created_at/ updated_at.
json
{
"auths": {
"swr.cn-north-4.myhuaweicloud.com": {
"auth": "base64-encoded-username:password"
}
}
}
Note: The auth field is base64-encoded. Decode it to get docker login credentials. This is a Docker config format, NOT a header+body response.
json
{
"quotas": [
{
"quota_key": "namespace",
"quota_limit": 5,
"used": 1,
"unit": ""
}
]
}
Note: Quotas are returned as an array of objects with quota_key/ quota_limit/ used/ unit fields, not flat key-value pairs like namespace_limit/ namespace_used.
See Verification Method for step-by-step verification.
Region NameRegion IDNorth China - Beijing 4cn-north-4North China - Beijing 1cn-north-1East China - Shanghai 1cn-east-3East China - Shanghai 2cn-east-2South China - Guangzhoucn-south-1South China - Shenzhencn-south-4Southwest China - Guiyang 1cn-southwest-2Asia Pacific - Bangkokap-southeast-2Asia Pacific - Singaporeap-southeast-1Asia Pacific - Hong Kongap-southeast-3Europe - Pariseu-west-0
team-backend, proj-ai)is_public=false for internal images; only set is_public=true for images intended for public sharingv1.0, v1.0-stable, latest) and avoid ambiguous tagsCreateRepoTag to create version aliases rather than pushing the same image multiple timesCreateSecret for automation pipelines; use CreateAuthorizationToken for temporary accessDocumentDescriptionSWR API Guidehcloud SWR API referenceIAM Permission PoliciesRequired permissions and policy JSONVerification MethodStep-by-step verificationCommon PitfallsTroubleshooting guidesTask: Namespace ManagementNamespace workflowsTask: Repository ManagementRepository workflowsTask: Tag ManagementTag workflowsTask: Auth ManagementLogin credential workflowsTask: Quota ManagementQuota check workflows
hcloud SWR <Operation> format--limit and --offset for repositories and tags listingSee Common Pitfalls & Solutions for detailed troubleshooting guides.
Quick Reference:
PitfallSymptomQuick FixInvalid namespace name400 Bad RequestFollow naming rules: lowercase, 1-64 charsNamespace not found404 Not FoundVerify namespace exists with ShowNamespaceRepo already exists409 ConflictUse ShowRepository to check firstTag digest mismatchRetag failsVerify source_tag exists with ShowRepoTagQuota exceeded403 Quota limitCheck quotas with ListQuotasAuth token expiredDocker login failsRegenerate with CreateAuthorizationToken``Tag field nameTag query returns unexpected structureUse Tag (capital T) not name``num_images not tag_countRepo listing field mismatchResponse uses num_images; --order_column uses tag_count