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 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: permission to access the namespace specified with-n; use-Aonly when you need to scan every namespace the current user can access
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 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.
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
For better performance, query a specific namespace whenever possible:
If the current context already specifies the target namespace, you can omit -n. If the current context does not specify a namespace, default is used.
Use -A only when you need to list images from every namespace that the current user is authorized to access. This can be slower on clusters with many namespaces or repositories.
By default, the output contains only REPOSITORY and TAG columns. Keep the default output for routine queries. Add -o wide only when you need created time and digest metadata because it requires additional metadata lookup and can increase command latency.
Use structured output when automation needs machine-readable data:
For JSON and YAML output, the default output also contains only repository and tag fields. Use -o wide only when digest and created-time metadata are required.
For large registries, you can tune the Registry catalog page size. The default is 200. Do not increase it unless you need larger catalog pages.
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.
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: