Common CLI Command Operations
Use the ac CLI for platform login, namespace permission management, and Registry metadata operations. Use a standard OCI client such as nerdctl for image transfer operations such as push and pull.
The examples below assume:
- Registry client address:
<REGISTRY_CLIENT_HOSTPORT> - Registry API URL:
<REGISTRY_API_URL> - Current namespace:
my-ns
TOC
Before You BeginHow Authentication WorksAuthenticate to ACPGrant namespace permissions to a userGrant namespace permissions to a ServiceAccountAuthenticate an OCI ClientList ImagesPull ImagesPush ImagesDelete ImagesBefore You Begin
Before running the commands in this document, make sure:
acis installed.nerdctlis installed if you need to push or pull images.- You can reach the ACP API endpoint and the Registry address from your current environment.
- You have logged in to ACP and selected the target cluster.
- Your current ACP account, or the ServiceAccount used in a Pod or Job, has the required namespace permissions.
Typical permission requirements:
- Pull images:
system:image-puller - Push images:
system:image-pusher - List images with
ac get images: access to the target namespaces - Delete images with
ac delete images: permission to delete images in the target namespaces
If you run ac inside a Pod, Job, or CronJob:
- The Pod must use a valid
serviceAccountName. - The mounted ServiceAccount token must be available.
- The ServiceAccount must have permissions to access the target cluster and Registry-related APIs.
How Authentication Works
ac and nerdctl use different authentication paths:
acuses the current ACP login session for Registry-related API access.- If
acruns inside a Pod and no ACP session is available, it can fall back to the mounted ServiceAccount token. nerdctlauthenticates directly to the Registry, typically by using the same ACP account credentials that already have access to the target namespace.
Address usage in this document:
<REGISTRY_CLIENT_HOSTPORT>is the Registry address used by OCI clients such asnerdctl.<REGISTRY_API_URL>is the Registry API endpoint used byac get imagesandac delete images.- In external access scenarios,
acshould typically use an explicitly specified--registry-urlinstead of relying on the default in-cluster Registry address.
Authenticate to ACP
Before using Registry-related commands in ac, log in and select the target cluster:
After login, ac can use the current session to access Registry-related APIs such as ac get images and ac delete images.
Grant namespace permissions to a user
Add namespace pull permission for a user.
Add namespace push permissions to a user.
Grant namespace permissions to a ServiceAccount
Add namespace pull permission for a service account.
Add namespace push permission for a service account.
Authenticate an OCI Client
For image push and pull, use the same ACP account credentials that have access to the target namespace:
If the Registry uses a self-signed certificate or plain HTTP, add the global flag --insecure-registry.
Example:
List Images
List images from namespaces that the current user is allowed to access:
When ac runs outside the cluster, explicitly specifying --registry-url is recommended. Otherwise, the CLI may fall back to the default in-cluster Registry address, which is often unreachable from a local workstation.
Example:
Pull Images
Pull an image from the Registry with nerdctl:
Push Images
Push a local image to the current namespace:
Copy an image from another registry into ACP Registry:
Delete Images
Use ac delete images to remove image tags from the Registry:
Notes:
- This operation removes the image manifest reference from the Registry, but it does not guarantee that the underlying image data is reclaimed immediately.
- In the current implementation, if multiple tags point to the same manifest digest, deleting one tag may also remove the sibling tags that reference the same manifest.
Example: