

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Amazon ECR Contoh Publik menggunakan AWS CLI
<a name="cli_ecr-public_code_examples"></a>

Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan AWS Command Line Interface With Amazon ECR Public.

*Tindakan* merupakan kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.

Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.

**Topics**
+ [Tindakan](#actions)

## Tindakan
<a name="actions"></a>

### `batch-delete-image`
<a name="ecr-public_BatchDeleteImage_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`batch-delete-image`.

**AWS CLI**  
**Contoh 1: Untuk menghapus gambar dengan menggunakan id intisari gambar, gambar dan semua tagnya dihapus dalam repositori di registri publik**  
`batch-delete-image`Contoh berikut menghapus gambar dengan menentukan image digest. :  

```
aws ecr-public batch-delete-image \
    --repository-name project-a/nginx-web-app \
    --image-ids imageDigest=sha256:b1f9deb5fe3711a3278379ebbcaefbc5d70a2263135db86bd27a0dae150546c2
```
Output:  

```
{
"imageIds": [
    {
        "imageDigest": "sha256:b1f9deb5fe3711a3278379ebbcaefbc5d70a2263135db86bd27a0dae150546c2",
        "imageTag": "latest"
    }
],
"failures": []
}
```
Untuk informasi selengkapnya, lihat [Menghapus gambar di repositori publik](https://docs.aws.amazon.com/AmazonECR/latest/public/public-image-delete.html) di Panduan Pengguna Publik *Amazon ECR*.  
**Contoh 2: Untuk menghapus gambar apa pun dengan menentukan tag yang terkait dengan gambar yang ingin Anda hapus dari repositori.**  
`batch-delete-image`Contoh berikut menghapus gambar dengan menentukan tag yang terkait dengan repositori gambar bernama `project-a/nginx-web-app` dalam registri publik. Jika Anda hanya memiliki satu tag dan menjalankan perintah ini, itu akan menghapus gambar. Jika tidak, jika Anda memiliki beberapa tag untuk gambar yang sama, tentukan satu, dan hanya tag yang dihapus dari repositori dan bukan gambar.  

```
aws ecr-public batch-delete-image \
    --repository-name project-a/nginx-web-app \
    --image-ids imageTag=_temp
```
Output:  

```
{
    "imageIds": [
        {
            "imageDigest": "sha256:f7a86a0760e2f8d7eff07e515fc87bf4bac45c35376c06f9a280f15ecad6d7e0",
            "imageTag": "_temp"
        }
    ],
    "failures": []
}
```
Untuk informasi selengkapnya, lihat [Menghapus gambar di repositori publik](https://docs.aws.amazon.com/AmazonECR/latest/public/public-image-delete.html) di Panduan Pengguna Publik *Amazon ECR*.  
**Contoh 3: Untuk menghapus beberapa gambar, Anda dapat menentukan beberapa tag gambar atau intisari gambar dalam permintaan repositori di registri publik.**  
`batch-delete-image`Contoh berikut menghapus beberapa gambar dari repositori bernama project-a/ nginx-web-app dengan menentukan beberapa tag gambar atau intisari gambar dalam permintaan.  

```
aws ecr-public batch-delete-image \
    --repository-name project-a/nginx-web-app \
    --image-ids imageTag=temp2.0  imageDigest=sha256:47ba980bc055353d9c0af89b1894f68faa43ca93856917b8406316be86f01278
```
Output:  

```
{
     "imageIds": [
         {
             "imageDigest": "sha256:47ba980bc055353d9c0af89b1894f68faa43ca93856917b8406316be86f01278"
         },
         {
             "imageDigest": "sha256:f7a86a0760e2f8d7eff07e515fc87bf4bac45c35376c06f9a280f15ecad6d7e0",
             "imageTag": "temp2.0"
         }
     ],
     "failures": []
 }
```
Untuk informasi selengkapnya, lihat [Menghapus gambar di repositori publik](https://docs.aws.amazon.com/AmazonECR/latest/public/public-image-delete.html) di Panduan Pengguna Publik *Amazon ECR*.  
**Contoh 4: Untuk menghapus gambar di AWS akun silang menggunakan id registry-dan id imagedigest, gambar dan semua tagnya dihapus dalam repositori di registri publik**  
`batch-delete-image`Contoh berikut menghapus gambar dengan menentukan intisari gambar di akun silang. AWS :  

```
aws ecr-public batch-delete-image \
    --registry-id 123456789098 \
    --repository-name project-a/nginx-web-app \
    --image-ids imageDigest=sha256:b1f9deb5fe3711a3278379ebbcaefbc5d70a2263135db86bd27a0dae150546c2 \
    --region us-east-1
```
Output:  

```
{
    "imageIds": [
        {
            "imageDigest": "sha256:b1f9deb5fe3711a3278379ebbcaefbc5d70a2263135db86bd27a0dae150546c2",
            "imageTag": "temp2.0"
        }
    ],
    "failures": []
}
```
Untuk informasi selengkapnya, lihat [Menghapus gambar di repositori publik](https://docs.aws.amazon.com/AmazonECR/latest/public/public-image-delete.html) di Panduan Pengguna Publik *Amazon ECR*.  
+  Untuk detail API, lihat [BatchDeleteImage](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/batch-delete-image.html)di *Referensi AWS CLI Perintah*. 

### `create-repository`
<a name="ecr-public_CreateRepository_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`create-repository`.

**AWS CLI**  
**Contoh 1: Untuk membuat repositori di registri publik**  
`create-repository`Contoh berikut membuat repositori bernama nginx-web-app project-a/ dalam registri publik.  

```
aws ecr-public create-repository \
    --repository-name project-a/nginx-web-app
```
Output:  

```
{
    "repository": {
        "repositoryArn": "arn:aws:ecr-public::123456789012:repository/project-a/nginx-web-app",
        "registryId": "123456789012",
        "repositoryName": "project-a/nginx-web-app",
        "repositoryUri": "public.ecr.aws/public-registry-custom-alias/project-a/nginx-web-app",
        "createdAt": "2024-07-01T21:08:55.131000+00:00"
    },
    "catalogData": {}
}
```
Untuk informasi selengkapnya, lihat [Membuat repositori publik di Panduan](https://docs.aws.amazon.com/AmazonECR/latest/public/public-repository-create.html) Pengguna *Publik Amazon ECR*.  
**Contoh 2: Untuk membuat repositori di registri publik dengan deskripsi singkat tentang isi repositori, sistem, dan arsitektur operasi yang kompatibel dengan gambar dalam repositori**  
`create-repository`Contoh berikut membuat repositori bernama project-a/ nginx-web-app dalam registri publik dengan deskripsi singkat tentang isi repositori, sistem dan arsitektur operasi yang gambar dalam repositori kompatibel dengan.  

```
aws ecr-public create-repository \
    --repository-name project-a/nginx-web-app \
    --catalog-data 'description=My project-a ECR Public Repository,architectures=ARM,ARM 64,x86,x86-64,operatingSystems=Linux'
```
Output:  

```
{
    "repository": {
        "repositoryArn": "arn:aws:ecr-public::123456789012:repository/project-a/nginx-web-app",
        "registryId": "123456789012",
        "repositoryName": "project-a/nginx-web-app",
        "repositoryUri": "public.ecr.aws/public-registry-custom-alias/project-a/nginx-web-app",
        "createdAt": "2024-07-01T21:23:20.455000+00:00"
    },
    "catalogData": {
        "description": "My project-a ECR Public Repository",
        "architectures": [
            "ARM",
            "ARM 64",
            "x86",
            "x86-64"
        ],
        "operatingSystems": [
            "Linux"
        ]
    }
}
```
Untuk informasi selengkapnya, lihat [Membuat repositori publik di Panduan](https://docs.aws.amazon.com/AmazonECR/latest/public/public-repository-create.html) Pengguna *Publik Amazon ECR*.  
**Contoh 3: Untuk membuat repositori di registri publik, bersama dengan, AboutText, logoImageBlob UsageText dan informasi tag**  
`create-repository`Contoh berikut membuat repositori bernama project-a/ nginx-web-app dalam registri publik, bersama dengan, AboutText, USAgeText dan logoImageBlob tag informasi.  

```
aws ecr-public create-repository \
    --cli-input-json file://myfile.json
```
Isi dari `myfile.json`:  

```
{
    "repositoryName": "project-a/nginx-web-app",
    "catalogData": {
        "description": "My project-a ECR Public Repository",
        "architectures": [
            "ARM",
            "ARM 64",
            "x86",
            "x86-64"
        ],
        "operatingSystems": [
            "Linux"
        ],
        "logoImageBlob": "iVBORw0KGgoA<<truncated-for-better-reading>>ErkJggg==",
        "aboutText": "## Quick reference\n\nMaintained by: [the Amazon Linux Team](https://github.com/aws/amazon-linux-docker-images)\n\nWhere to get help: [the Docker Community Forums](https://forums.docker.com/), [the Docker Community Slack](https://dockr.ly/slack), or [Stack Overflow](https://stackoverflow.com/search?tab=newest&q=docker)\n\n## Supported tags and respective `dockerfile` links\n\n* [`2.0.20200722.0`, `2`, `latest`](https://github.com/amazonlinux/container-images/blob/03d54f8c4d522bf712cffd6c8f9aafba0a875e78/Dockerfile)\n* [`2.0.20200722.0-with-sources`, `2-with-sources`, `with-sources`](https://github.com/amazonlinux/container-images/blob/1e7349845e029a2e6afe6dc473ef17d052e3546f/Dockerfile)\n* [`2018.03.0.20200602.1`, `2018.03`, `1`](https://github.com/amazonlinux/container-images/blob/f10932e08c75457eeb372bf1cc47ea2a4b8e98c8/Dockerfile)\n* [`2018.03.0.20200602.1-with-sources`, `2018.03-with-sources`, `1-with-sources`](https://github.com/amazonlinux/container-images/blob/8c9ee491689d901aa72719be0ec12087a5fa8faf/Dockerfile)\n\n## What is Amazon Linux?\n\nAmazon Linux is provided by Amazon Web Services (AWS). It is designed to provide a stable, secure, and high-performance execution environment for applications running on Amazon EC2. The full distribution includes packages that enable easy integration with AWS, including launch configuration tools and many popular AWS libraries and tools. AWS provides ongoing security and maintenance updates to all instances running Amazon Linux.\n\nThe Amazon Linux container image contains a minimal set of packages. To install additional packages, [use `yum`](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managing-software.html).\n\nAWS provides two versions of Amazon Linux: [Amazon Linux 2](https://aws.amazon.com/amazon-linux-2/) and [Amazon Linux AMI](https://aws.amazon.com/amazon-linux-ami/).\n\nFor information on security updates for Amazon Linux, please refer to [Amazon Linux 2 Security Advisories](https://alas.aws.amazon.com/alas2.html) and [Amazon Linux AMI Security Advisories](https://alas.aws.amazon.com/). Note that Docker Hub's vulnerability scanning for Amazon Linux is currently based on RPM versions, which does not reflect the state of backported patches for vulnerabilities.\n\n## Where can I run Amazon Linux container images?\n\nYou can run Amazon Linux container images in any Docker based environment. Examples include, your laptop, in Amazon EC2 instances, and Amazon ECS clusters.\n\n## License\n\nAmazon Linux is available under the [GNU General Public License, version 2.0](https://github.com/aws/amazon-linux-docker-images/blob/master/LICENSE). Individual software packages are available under their own licenses; run `rpm -qi [package name]` or check `/usr/share/doc/[package name]-*` and `/usr/share/licenses/[package name]-*` for details.\n\nAs with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).\n\nSome additional license information which was able to be auto-detected might be found in [the `repo-info` repository's `amazonlinux/` directory](https://github.com/docker-library/repo-info/tree/master/repos/amazonlinux).\n\n## Security\n\nFor information on security updates for Amazon Linux, please refer to [Amazon Linux 2 Security Advisories](https://alas.aws.amazon.com/alas2.html) and [Amazon Linux AMI Security Advisories](https://alas.aws.amazon.com/). Note that Docker Hub's vulnerability scanning for Amazon Linux is currently based on RPM versions, which does not reflect the state of backported patches for vulnerabilities.",
        "usageText": "## Supported architectures\n\namd64, arm64v8\n\n## Where can I run Amazon Linux container images?\n\nYou can run Amazon Linux container images in any Docker based environment. Examples include, your laptop, in Amazon EC2 instances, and ECS clusters.\n\n## How do I install a software package from Extras repository in Amazon Linux 2?\n\nAvailable packages can be listed with the `amazon-linux-extras` command. Packages can be installed with the `amazon-linux-extras install <package>` command. Example: `amazon-linux-extras install rust1`\n\n## Will updates be available for Amazon Linux containers?\n\nSimilar to the Amazon Linux images for Amazon EC2 and on-premises use, Amazon Linux container images will get ongoing updates from Amazon in the form of security updates, bug fix updates, and other enhancements. Security bulletins for Amazon Linux are available at https://alas.aws.amazon.com/\n\n## Will AWS Support the current version of Amazon Linux going forward?\n\nYes; in order to avoid any disruption to your existing applications and to facilitate migration to Amazon Linux 2, AWS will provide regular security updates for Amazon Linux 2018.03 AMI and container image for 2 years after the final LTS build is announced. You can also use all your existing support channels such as AWS Support and Amazon Linux Discussion Forum to continue to submit support requests."
    },
    "tags": [
        {
            "Key": "Name",
            "Value": "project-a/nginx-web-app"
        },
        {
            "Key": "Environment",
            "Value": "Prod"
        }
    ]
}
```
Output:  

```
{
    "repository": {
        "repositoryArn": "arn:aws:ecr-public::123456789012:repository/project-a/nginx-web-app",
        "registryId": "123456789012",
        "repositoryName": "project-a/nginx-web-app",
        "repositoryUri": "public.ecr.aws/public-registry-custom-alias/project-a/nginx-web-app",
        "createdAt": "2024-07-01T21:53:05.749000+00:00"
    },
    "catalogData": {
        "description": "My project-a ECR Public Repository",
        "architectures": [
            "ARM",
            "ARM 64",
            "x86",
            "x86-64"
        ],
        "operatingSystems": [
            "Linux"
        ],
        "logoUrl": "https://d3g9o9u8re44ak.cloudfront.net/logo/23861450-4b9b-403c-9a4c-7aa0ef140bb8/2f9bf5a7-a32f-45b4-b5cd-c5770a35e6d7.png",
        "aboutText": "## Quick reference\n\nMaintained by: [the Amazon Linux Team](https://github.com/aws/amazon-linux-docker-images)\n\nWhere to get help: [the Docker Community Forums](https://forums.docker.com/), [the Docker Community Slack](https://dockr.ly/slack), or [Stack Overflow](https://stackoverflow.com/search?tab=newest&q=docker)\n\n## Supported tags and respective `dockerfile` links\n\n* [`2.0.20200722.0`, `2`, `latest`](https://github.com/amazonlinux/container-images/blob/03d54f8c4d522bf712cffd6c8f9aafba0a875e78/Dockerfile)\n* [`2.0.20200722.0-with-sources`, `2-with-sources`, `with-sources`](https://github.com/amazonlinux/container-images/blob/1e7349845e029a2e6afe6dc473ef17d052e3546f/Dockerfile)\n* [`2018.03.0.20200602.1`, `2018.03`, `1`](https://github.com/amazonlinux/container-images/blob/f10932e08c75457eeb372bf1cc47ea2a4b8e98c8/Dockerfile)\n* [`2018.03.0.20200602.1-with-sources`, `2018.03-with-sources`, `1-with-sources`](https://github.com/amazonlinux/container-images/blob/8c9ee491689d901aa72719be0ec12087a5fa8faf/Dockerfile)\n\n## What is Amazon Linux?\n\nAmazon Linux is provided by Amazon Web Services (AWS). It is designed to provide a stable, secure, and high-performance execution environment for applications running on Amazon EC2. The full distribution includes packages that enable easy integration with AWS, including launch configuration tools and many popular AWS libraries and tools. AWS provides ongoing security and maintenance updates to all instances running Amazon Linux.\n\nThe Amazon Linux container image contains a minimal set of packages. To install additional packages, [use `yum`](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managing-software.html).\n\nAWS provides two versions of Amazon Linux: [Amazon Linux 2](https://aws.amazon.com/amazon-linux-2/) and [Amazon Linux AMI](https://aws.amazon.com/amazon-linux-ami/).\n\nFor information on security updates for Amazon Linux, please refer to [Amazon Linux 2 Security Advisories](https://alas.aws.amazon.com/alas2.html) and [Amazon Linux AMI Security Advisories](https://alas.aws.amazon.com/). Note that Docker Hub's vulnerability scanning for Amazon Linux is currently based on RPM versions, which does not reflect the state of backported patches for vulnerabilities.\n\n## Where can I run Amazon Linux container images?\n\nYou can run Amazon Linux container images in any Docker based environment. Examples include, your laptop, in Amazon EC2 instances, and Amazon ECS clusters.\n\n## License\n\nAmazon Linux is available under the [GNU General Public License, version 2.0](https://github.com/aws/amazon-linux-docker-images/blob/master/LICENSE). Individual software packages are available under their own licenses; run `rpm -qi [package name]` or check `/usr/share/doc/[package name]-*` and `/usr/share/licenses/[package name]-*` for details.\n\nAs with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).\n\nSome additional license information which was able to be auto-detected might be found in [the `repo-info` repository's `amazonlinux/` directory](https://github.com/docker-library/repo-info/tree/master/repos/amazonlinux).\n\n## Security\n\nFor information on security updates for Amazon Linux, please refer to [Amazon Linux 2 Security Advisories](https://alas.aws.amazon.com/alas2.html) and [Amazon Linux AMI Security Advisories](https://alas.aws.amazon.com/). Note that Docker Hub's vulnerability scanning for Amazon Linux is currently based on RPM versions, which does not reflect the state of backported patches for vulnerabilities.",
        "usageText": "## Supported architectures\n\namd64, arm64v8\n\n## Where can I run Amazon Linux container images?\n\nYou can run Amazon Linux container images in any Docker based environment. Examples include, your laptop, in Amazon EC2 instances, and ECS clusters.\n\n## How do I install a software package from Extras repository in Amazon Linux 2?\n\nAvailable packages can be listed with the `amazon-linux-extras` command. Packages can be installed with the `amazon-linux-extras install <package>` command. Example: `amazon-linux-extras install rust1`\n\n## Will updates be available for Amazon Linux containers?\n\nSimilar to the Amazon Linux images for Amazon EC2 and on-premises use, Amazon Linux container images will get ongoing updates from Amazon in the form of security updates, bug fix updates, and other enhancements. Security bulletins for Amazon Linux are available at https://alas.aws.amazon.com/\n\n## Will AWS Support the current version of Amazon Linux going forward?\n\nYes; in order to avoid any disruption to your existing applications and to facilitate migration to Amazon Linux 2, AWS will provide regular security updates for Amazon Linux 2018.03 AMI and container image for 2 years after the final LTS build is announced. You can also use all your existing support channels such as AWS Support and Amazon Linux Discussion Forum to continue to submit support requests."
    }
}
```
Untuk informasi selengkapnya, lihat [Membuat repositori publik](https://docs.aws.amazon.com/AmazonECR/latest/public/public-repository-create.html) di *Panduan Pengguna Publik Amazon ECR dan [data katalog Repositori di](https://docs.aws.amazon.com/AmazonECR/latest/public/public-repository-catalog-data.html) Panduan Pengguna Publik* *Amazon* ECR.  
+  Untuk detail API, lihat [CreateRepository](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/create-repository.html)di *Referensi AWS CLI Perintah*. 

### `delete-repository-policy`
<a name="ecr-public_DeleteRepositoryPolicy_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`delete-repository-policy`.

**AWS CLI**  
**Untuk menghapus kebijakan repositori di registri publik**  
`delete-repository-policy`Contoh berikut menghapus kebijakan repositori untuk repositori Publik ECR di akun Anda. AWS   

```
aws ecr-public delete-repository-policy \
     --repository-name project-a/nginx-web-app \
     --region us-east-1
```
Output:  

```
{
    "registryId": "123456789012",
    "repositoryName": "project-a/nginx-web-app",
    "policyText": "{\n  \"Version\" : \"2008-10-17\",\n  \"Statement\" : [ {\n    \"Sid\" : \"AllowPush\",\n    \"Effect\" : \"Allow\",\n    \"Principal\" : {\n      \"AWS\" : [ \"arn:aws:iam:"123456789012":user/eksuser1\", \"arn:aws:iam:"123456789012":user/admin\" ]\n    },\n    \"Action\" : [ \"ecr-public:BatchCheckLayerAvailability\", \"ecr-public:PutImage\", \"ecr-public:InitiateLayerUpload\", \"ecr-public:UploadLayerPart\", \"ecr-public:CompleteLayerUpload\" ]\n  } ]\n}"
}
```
Untuk informasi selengkapnya, lihat [Menghapus pernyataan kebijakan repositori publik](https://docs.aws.amazon.com/AmazonECR/latest/public/delete-public-repository-policy.html) di Panduan Pengguna Publik *Amazon ECR*.  
+  Untuk detail API, lihat [DeleteRepositoryPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/delete-repository-policy.html)di *Referensi AWS CLI Perintah*. 

### `delete-repository`
<a name="ecr-public_DeleteRepository_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`delete-repository`.

**AWS CLI**  
**Untuk menghapus repositori di registri publik**  
`delete-repository`Contoh berikut menghapus repositori bernama `project-a/nginx-web-app` dari registri publik Anda.  

```
aws ecr-public delete-repository \
    --repository-name project-a/nginx-web-app
```
Output:  

```
{
    "repository": {
        "repositoryArn": "arn:aws:ecr-public::123456789012:repository/project-a/nginx-web-app",
        "registryId": "123456789012",
        "repositoryName": "project-a/nginx-web-app",
        "repositoryUri": "public.ecr.aws/public-registry-custom-alias/project-a/nginx-web-app",
        "createdAt": "2024-07-01T22:14:50.103000+00:00"
    }
}
```
Untuk informasi selengkapnya, lihat [Menghapus repositori publik](https://docs.aws.amazon.com/AmazonECR/latest/public/public-repository-delete.html) di *Amazon* ECR Public.  
+  Untuk detail API, lihat [DeleteRepository](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/delete-repository.html)di *Referensi AWS CLI Perintah*. 

### `describe-image-tags`
<a name="ecr-public_DescribeImageTags_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-image-tags`.

**AWS CLI**  
**Contoh 1: Untuk mendeskripsikan detail tag gambar di repositori publik**  
`describe-image-tags`Contoh berikut menggambarkan imagetags dalam repositori sampel. `project-a/nginx-web-app`  

```
aws ecr-public describe-image-tags \
    --repository-name project-a/nginx-web-app \
    --region us-east-1
```
Output:  

```
{
    "imageTagDetails": [
        {
            "imageTag": "latest",
            "createdAt": "2024-07-10T22:29:00-05:00",
            "imageDetail": {
                "imageDigest": "sha256:b1f9deb5fe3711a3278379ebbcaefbc5d70a2263135db86bd27a0dae150546c2",
                "imageSizeInBytes": 121956548,
                "imagePushedAt": "2024-07-10T22:29:00-05:00",
                "imageManifestMediaType": "application/vnd.docker.distribution.manifest.v2+json",
                "artifactMediaType": "application/vnd.docker.container.image.v1+json"
            }
        }
    ]
}
```
+  Untuk detail API, lihat [DescribeImageTags](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/describe-image-tags.html)di *Referensi AWS CLI Perintah*. 

### `describe-images`
<a name="ecr-public_DescribeImages_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-images`.

**AWS CLI**  
**Contoh 1: Untuk mendeskripsikan gambar dalam repositori registri publik**  
`describe-images`Contoh berikut menjelaskan ImagesDetails dalam repositori bernama `project-a/nginx-web-app` dalam registri publik.  

```
aws ecr-public describe-images \
    --repository-name project-a/nginx-web-app \
    --region us-east-1
```
Output:  

```
{
    "imageDetails": [
        {
            "registryId": "123456789012",
            "repositoryName": "project-a/nginx-web-app",
            "imageDigest": "sha256:0d8c93e72e82fa070d49565c00af32abbe8ddfd7f75e39f4306771ae0628c7e8",
            "imageTags": [
                "temp1.0"
            ],
            "imageSizeInBytes": 123184716,
            "imagePushedAt": "2024-07-23T11:32:49-05:00",
            "imageManifestMediaType": "application/vnd.docker.distribution.manifest.v2+json",
            "artifactMediaType": "application/vnd.docker.container.image.v1+json"
        },
        {
            "registryId": "123456789012",
            "repositoryName": "project-a/nginx-web-app",
            "imageDigest": "sha256:b1f9deb5fe3711a3278379ebbcaefbc5d70a2263135db86bd27a0dae150546c2",
            "imageTags": [
                "temp2.0"
            ],
            "imageSizeInBytes": 121956548,
            "imagePushedAt": "2024-07-23T11:39:38-05:00",
            "imageManifestMediaType": "application/vnd.docker.distribution.manifest.v2+json",
            "artifactMediaType": "application/vnd.docker.container.image.v1+json"
        },
        {
            "registryId": "123456789012",
            "repositoryName": "project-a/nginx-web-app",
            "imageDigest": "sha256:f7a86a0760e2f8d7eff07e515fc87bf4bac45c35376c06f9a280f15ecad6d7e0",
            "imageTags": [
                "temp3.0",
                "latest"
            ],
            "imageSizeInBytes": 232108879,
            "imagePushedAt": "2024-07-22T00:54:34-05:00",
            "imageManifestMediaType": "application/vnd.docker.distribution.manifest.v2+json",
            "artifactMediaType": "application/vnd.docker.container.image.v1+json"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Menjelaskan gambar di repositori publik](https://docs.aws.amazon.com/AmazonECR/latest/public/docker-push-multi-architecture-image.html) di *Amazon ECR* Public.  
**Contoh 2: Untuk mendeskripsikan gambar dari repositori dengan mengurutkan ImageTags & imagePushedAt**  
`describe-images`Contoh berikut menggambarkan gambar dalam repositori bernama nginx-web-app project-a/ dalam registri publik.  

```
aws ecr-public describe-images \
    --repository-name project-a/nginx-web-app \
    --query 'sort_by(imageDetails,& imagePushedAt)[*].imageTags[*]' \
    --output text
```
Output:  

```
temp3.0 latest
temp1.0
temp2.0
```
**Contoh 3: Untuk mendeskripsikan gambar dari repositori untuk menghasilkan 2 tag gambar terakhir yang didorong di repositori**  
`describe-images`Contoh berikut mendapatkan rincian imagetags dari repositori bernama `project-a/nginx-web-app` dalam registri publik dan query hasilnya untuk menampilkan hanya dua catatan pertama.  

```
aws ecr-public describe-images \
    --repository-name project-a/nginx-web-app  \
    --query 'sort_by(imageDetails,& imagePushedAt)[*].imageTags[*] | [0:2]' \
    --output text
```
Output:  

```
temp3.0 latest
temp1.0
```
+  Untuk detail API, lihat [DescribeImages](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/describe-images.html)di *Referensi AWS CLI Perintah*. 

### `describe-registries`
<a name="ecr-public_DescribeRegistries_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-registries`.

**AWS CLI**  
**Untuk menggambarkan semua pendaftar dalam registri publik**  
`describe-registries`Contoh berikut menjelaskan semua pendaftar di akun Anda.  

```
aws ecr-public describe-registries
```
Output:  

```
{
 "registries": [
     {
         "registryId": "123456789012",
         "registryArn": "arn:aws:ecr-public::123456789012:registry/123456789012",
         "registryUri": "public.ecr.aws/publicregistrycustomalias",
         "verified": false,
         "aliases": [
             {
                 "name": "publicregistrycustomalias",
                 "status": "ACTIVE",
                 "primaryRegistryAlias": true,
                 "defaultRegistryAlias": true
             }
         ]
     }
     ]
 }
```
+  Untuk detail API, lihat [DescribeRegistries](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/describe-registries.html)di *Referensi AWS CLI Perintah*. 

### `describe-repository`
<a name="ecr-public_DescribeRepository_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-repository`.

**AWS CLI**  
**Contoh 1: Untuk mendeskripsikan repositori dalam registri publik**  
`describe-repositories`Contoh berikut menjelaskan repositori bernama `project-a/nginx-web-app` dalam registri publik.  

```
aws ecr-public describe-repositories \
    --repository-name project-a/nginx-web-app
```
Output:  

```
{
    "repositories": [
        {
            "repositoryArn": "arn:aws:ecr-public::123456789012:repository/project-a/nginx-web-app",
            "registryId": "123456789012",
            "repositoryName": "project-a/nginx-web-app",
            "repositoryUri": "public.ecr.aws/public-registry-custom-alias/project-a/nginx-web-app",
            "createdAt": "2024-07-07T00:07:56.526000-05:00"
        }
    ]
}
```
**Contoh 2: Untuk mendeskripsikan semua repositori dalam registri publik dalam tabel**  
`describe-repositories`Contoh berikut menjelaskan semua repositori dalam registri publik dan kemudian mengeluarkan nama repositori ke dalam format tabel.  

```
aws ecr-public describe-repositories \
    --region us-east-1 \
    --output table \
    --query "repositories[*].repositoryName"
```
Output:  

```
-----------------------------
|   DescribeRepositories    |
+---------------------------+
|  project-a/nginx-web-app  |
|  nginx                    |
|  myfirstrepo1             |
|  helm-test-chart          |
|  test-ecr-public          |
|  nginx-web-app            |
|  sample-repo              |
+---------------------------+
```
+  Untuk detail API, lihat [DescribeRepository](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/describe-repository.html)di *Referensi AWS CLI Perintah*. 

### `get-authorization-token`
<a name="ecr-public_GetAuthorizationToken_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`get-authorization-token`.

**AWS CLI**  
**Contoh 1: Untuk mengambil token otorisasi untuk registri publik Amazon ECR apa pun yang dapat diakses oleh kepala sekolah IAM**  
`get-authorization-token`Contoh berikut mendapatkan token otorisasi dengan AWS CLI dan menyetelnya ke variabel lingkungan.  

```
aws ecr-public get-authorization-token \
    --region us-east-1
```
Output:  

```
{
    "authorizationData": {
        "authorizationToken": "QVdTOmV5SndZWGxzYjJKJFHDSFKJHERWUY65IOU36TRYEGFNSDLRIUOTUYTHJKLDFGOcmFUQk9OSFV2UVV4a0x6Sm1ZV0Z6TDFndlZtUjJSVmgxVEVObU9IZEdTWEZxU210c1JUQm5RWGxOUVV4NlNFUnROWG92ZWtGbWJFUjRkbWMyV0U5amFpczRNWGxTVkM5Tk5qWkVUM2RDYm05TVJqSkxjV3BsUVZvMmFYSm5iV1ZvVFdGSVRqVlFMMHN4VnpsTGVXbDFRWGRoTmpsbWFuQllhbVl6TkdGaGMwUjJha2xsYUhscWRscHZTRUpFVkVnNVQwNUdOVFpPY2xZclVFNVFVWGRSVFZvd04xUkhjVGxZZFVkQ1ZFZHBPRUptUzBVclYxQldMMjVMVkRsd2VFVlNSa1EzTWpWSlIxRkVWakJGZFZOVWEzaFBSVk5FWWpSc1lWZHZWMHBSYm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SWpvaU15SXNJblI1Y0dVaU9pSkVRVlJCWDB0RldTSXNJbVY0Y0dseVlYUnBiMjRpT2pFM01qRTVOVGMzTmpKOQ==",
        "expiresAt": "2024-07-25T21:37:26.301000-04:00"
    }
}
```
Untuk informasi selengkapnya, lihat [pendaftar publik Amazon ECR](https://docs.aws.amazon.com/AmazonECR/latest/public/public-registries.html#registry_auth_http) di *Amazon* ECR Public.  
**Contoh 2: Untuk mengambil token otorisasi untuk registri publik Amazon ECR apa pun yang dapat diakses oleh kepala sekolah IAM**  
`get-authorization-token`Contoh berikut mendapatkan token otorisasi dengan AWS CLI dan menyetelnya ke variabel lingkungan.  

```
aws ecr-public get-authorization-token \
    --region us-east-1 \
    --output=text \
    --query 'authorizationData.authorizationToken'
```
Output:  

```
QVdTOmV5SndZWGxzYjJKJFHDSFKJHERWUY65IOU36TRYEGFNSDLRIUOTUYTHJKLDFGOcmFUQk9OSFV2UVV4a0x6Sm1ZV0Z6TDFndlZtUjJSVmgxVEVObU9IZEdTWEZxU210c1JUQm5RWGxOUVV4NlNFUnROWG92ZWtGbWJFUjRkbWMyV0U5amFpczRNWGxTVkM5Tk5qWkVUM2RDYm05TVJqSkxjV3BsUVZvMmFYSm5iV1ZvVFdGSVRqVlFMMHN4VnpsTGVXbDFRWGRoTmpsbWFuQllhbVl6TkdGaGMwUjJha2xsYUhscWRscHZTRUpFVkVnNVQwNUdOVFpPY2xZclVFNVFVWGRSVFZvd04xUkhjVGxZZFVkQ1ZFZHBPRUptUzBVclYxQldMMjVMVkRsd2VFVlNSa1EzTWpWSlIxRkVWakJGZFZOVWEzaFBSVk5FWWpSc1lWZHZWMHBSYmxaMlJYWmhZekpaWVVOeFppdFlUa2xKU1RCdFUwdElVbXRJYlhGRk1WaFhNVTVRTkdwc1FYRlVNVWxZZUhkV05Xa3ZXWGd3ZUVZMWIyeE5VRU5QZEdSaWRHOU9lakZOZVdwTVZEUkNRVzlvYzNKSlpsRXhhR2cwWjJwRVJF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RmRTUTJORVFUQlpWMk01VUZOSmMwbHJiRUpTUTBrMlNXNUZlbHA2U1RGVVZXeFVZekIwYVU5RWFEVmtiRVpzVVZWc2QxbHJWbmxOYW13MVZWaG9UazVzVWpWbFJHaDZZMjFHVkZVeFFubFZXRTVLVGpCMGFXSlZNWGhpUjBwTVlUSTVNRTVVYXpCTE0wVnlWakF4VG1WSE5VcGtSa0pRVld4V1UwOVdVWGhqTVc4eVZraFdlVnA2VGsxV01tUnhVV3Q0ZEdGcVRsUk5hMnN5V2tSV2FtUkdVakZqVm5CUFVrUlNjR0pHUm1GbGFscDRXV2x6Y2xFd1VYcGhSRnBZVmtaU2FVNXVSVFZYYlVaVFpXdHdkVmRZVGpaVGEyaDBWMnhDVlU0elZrWlRSRUpIVlVWa2MwNVlhRFZsUkVwelQwWkNSbE5WY0ZGWFNFWXhaVmMxVEZsVE9VeFdhMGt4V1ROS1Rrd3pXazFpYkhCdFVrUldWRlJHVlhaTmJVazBZbFZzUkV3d2N6UldSV2MxVDBWa05tSXpiM2hXVms1V1ZtMDFiRkZUT1hoUFJVcHpUMGRzU2xaSVJrTkxNVTVFWWtaa05WWnViRmRYVjJRd1RXcG5kMVJWUmpCa1JYQkdZVlYwZFZNeU1VVlpWVTVQV25wa1ExZHFVbE5sUjBaRVlWVTFXbVZwY3pSTE1HTTFVbFZGTlZwRll6UlRSMVoxVFcxb05XTnJkRUpWZWxsM1RETmplbUV4WkdGU1JsWm9ZVVpzZEdWR2JFTlVNblJYVkRCNE5HUXlkRXhaTWxKTlYxZDBWRTB5YUZwaFJsazFVMGR3Y0ZGVk9YaGxhekV6VVZRd09VbHVNRDBpTENKMlpYSnphVzl1SWpvaU15SXNJblI1Y0dVaU9pSkVRVlJCWDB0RldTSXNJbVY0Y0dseVlYUnBiMjRpT2pFM01qRTVOVGMzTmpKOQ
```
Untuk informasi selengkapnya, lihat [pendaftar publik Amazon ECR](https://docs.aws.amazon.com/AmazonECR/latest/public/public-registries.html#registry_auth_http) di *Amazon* ECR Public.  
+  Untuk detail API, lihat [GetAuthorizationToken](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/get-authorization-token.html)di *Referensi AWS CLI Perintah*. 

### `get-login-password`
<a name="ecr-public_GetLoginPassword_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`get-login-password`.

**AWS CLI**  
**Contoh 1: Untuk mengautentikasi docker ke registri publik Amazon ECR**  
`get-login-password`Contoh berikut mengambil dan menampilkan token otentikasi menggunakan GetAuthorizationToken API yang dapat Anda gunakan untuk mengautentikasi ke registri publik Amazon ECR.  

```
aws ecr-public get-login-password \
    --region us-east-1
| docker login \
    --username AWS \
    --password-stdin public.ecr.aws
```
Perintah ini tidak menghasilkan output di terminal melainkan menyalurkan output ke Docker.  
Untuk informasi selengkapnya, lihat [Mengautentikasi ke registri publik](https://docs.aws.amazon.com/AmazonECR/latest/public/public-registries.html#public-registry-auth) di *Amazon ECR* Public.  
**Contoh 2: Untuk mengautentikasi docker ke registri publik AmazonECR kustom Anda sendiri**  
`get-login-password`Contoh berikut mengambil dan menampilkan token otentikasi menggunakan GetAuthorizationToken API yang dapat Anda gunakan untuk mengautentikasi ke registri publik Amazon ECR kustom Anda sendiri.  

```
 aws ecr-public get-login-password \
    --region us-east-1 \
| docker login \
    --username AWS \
    --password-stdin public.ecr.aws/<your-public-registry-custom-alias>
```
Perintah ini tidak menghasilkan output di terminal tetapi sebaliknya menyalurkan output ke Docker.  
Untuk informasi selengkapnya, lihat [Mengautentikasi ke Publik ECR Amazon Anda sendiri di *Amazon ECR* Public](https://docs.aws.amazon.com/AmazonECR/latest/public/public-registries.html#public-registry-auth).  
+  Untuk detail API, lihat [GetLoginPassword](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/get-login-password.html)di *Referensi AWS CLI Perintah*. 

### `get-registry-catalog-data`
<a name="ecr-public_GetRegistryCatalogData_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`get-registry-catalog-data`.

**AWS CLI**  
**Untuk mengambil metadata katalog untuk registri ECR publik**  
Berikut ini `get-registry-catalog-data` mengambil metadata katalog untuk registri publik ECR.  

```
aws ecr-public get-registry-catalog-data \
    --region us-east-1
```
Output:  

```
{
    "registryCatalogData": {
        "displayName": "YourCustomPublicRepositoryalias"
    }
}
```
+  Untuk detail API, lihat [GetRegistryCatalogData](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/get-registry-catalog-data.html)di *Referensi AWS CLI Perintah*. 

### `get-repository-catalog-data`
<a name="ecr-public_GetRepositoryCatalogData_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`get-repository-catalog-data`.

**AWS CLI**  
**Untuk mengambil metadata katalog untuk repositori di registri publik**  
`get-repository-catalog-data`Contoh berikut mencantumkan metadata katalog untuk repositori `project-a/nginx-web-app` dalam registri publik.  

```
aws ecr-public get-repository-catalog-data \
    --repository-name project-a/nginx-web-app \
    --region us-east-1
```
Output:  

```
{
    "catalogData": {
        "description": "My project-a ECR Public Repository",
        "architectures": [
            "ARM",
            "ARM 64",
            "x86",
            "x86-64"
        ],
        "operatingSystems": [
            "Linux"
        ],
        "logoUrl": "https://d3g9o9u8re44ak.cloudfront.net/logo/491d3846-8f33-4d8b-a10c-c2ce271e6c0d/4f09d87c-2569-4916-a932-5c296bf6f88a.png",
        "aboutText": "## Quick reference\n\nMaintained <truncated>",
        "usageText": "## Supported architectures\n\namd64, arm64v8\n\n## <truncated>"
    }
}
```
Untuk informasi selengkapnya, lihat [Data katalog repositori](https://docs.aws.amazon.com/AmazonECR/latest/public/public-repository-catalog-data.html) di *Amazon ECR* Public.  
+  Untuk detail API, lihat [GetRepositoryCatalogData](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/get-repository-catalog-data.html)di *Referensi AWS CLI Perintah*. 

### `get-repository-policy`
<a name="ecr-public_GetRepositoryPolicy_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`get-repository-policy`.

**AWS CLI**  
**Untuk mendapatkan kebijakan repositori yang terkait dengan repositori**  
`get-repository-policy`Contoh berikut mendapat kebijakan repositori yang terkait dengan repositori.  

```
aws ecr-public get-repository-policy \
    --repository-name project-a/nginx-web-app \
    --region us-east-1
```
Output:  

```
{
    "registryId": "123456789012",
    "repositoryName": "project-a/nginx-web-app",
    "policyText": "{\n  \"Version\" : \"2008-10-17\",\n  \"Statement\" : [ {\n    \"Sid\" : \"AllowPush\",\n    \"Effect\" : \"Allow\",\n    \"Principal\" : {\n      \"AWS\" : [ \"arn:aws:iam::123456789012:user/eksuser1\", \"arn:aws:iam::123456789012:user/admin\" ]\n    },\n    \"Action\" : [ \"ecr-public:BatchCheckLayerAvailability\", \"ecr-public:PutImage\", \"ecr-public:InitiateLayerUpload\", \"ecr-public:UploadLayerPart\", \"ecr-public:CompleteLayerUpload\" ]\n  } ]\n}"
}
```
Untuk informasi selengkapnya, lihat [Menggunakan GetRepositoryPolicy dengan AWS SDK atau CLI](https://docs.aws.amazon.com/AmazonECR/latest/userguide/example_ecr_GetRepositoryPolicy_section.html) di Panduan Pengguna *Publik Amazon ECR*.  
+  Untuk detail API, lihat [GetRepositoryPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/get-repository-policy.html)di *Referensi AWS CLI Perintah*. 

### `list-tags-for-resource`
<a name="ecr-public_ListTagsForResource_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`list-tags-for-resource`.

**AWS CLI**  
**Untuk daftar tag untuk repositori publik dalam registri publik**  
`list-tags-for-resource`Contoh berikut mencantumkan tag untuk sumber daya bernama `project-a/nginx-web-app` dalam registri publik.  

```
aws ecr-public list-tags-for-resource \
    --resource-arn arn:aws:ecr-public::123456789012:repository/project-a/nginx-web-app \
    --region us-east-1
```
Output:  

```
{
    "tags": [
        {
            "Key": "Environment",
            "Value": "Prod"
        },
        {
            "Key": "stack",
            "Value": "dev1"
        },
        {
            "Key": "Name",
            "Value": "project-a/nginx-web-app"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Daftar tag untuk repositori publik](https://docs.aws.amazon.com/AmazonECR/latest/public/ecr-public-using-tags.html) di *Amazon ECR* Public.  
+  Untuk detail API, lihat [ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/list-tags-for-resource.html)di *Referensi AWS CLI Perintah*. 

### `put-registry-catalog-data`
<a name="ecr-public_PutRegistryCatalogData_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`put-registry-catalog-data`.

**AWS CLI**  
**Untuk membuat atau memperbarui metadata katalog untuk registri ECR publik**  
Berikut ini `put-registry-catalog-data` membuat atau memperbarui metadata katalog untuk registri publik ECR. Hanya akun yang memiliki lencana akun terverifikasi yang dapat memiliki nama tampilan registri.  

```
aws ecr-public put-registry-catalog-data \
    --region us-east-1 \
    --display-name <YourCustomPublicRepositoryalias>
```
Output:  

```
{
    "registryCatalogData": {
        "displayName": "YourCustomPublicRepositoryalias"
    }
}
```
+  Untuk detail API, lihat [PutRegistryCatalogData](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/put-registry-catalog-data.html)di *Referensi AWS CLI Perintah*. 

### `put-repository-catalog-data`
<a name="ecr-public_PutRepositoryCatalogData_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`put-repository-catalog-data`.

**AWS CLI**  
**Untuk membuat atau memperbarui data katalog untuk repositori di registri publik**  
`put-repository-catalog-data`Contoh berikut membuat atau memperbarui data katalog untuk reposiotry bernama project-a/ nginx-web-app dalam registri publik, bersama dengan logoImageBlob, AboutText, UsageText dan tag informasi.  

```
aws ecr-public put-repository-catalog-data \
    --repository-name project-a/nginx-web-app \
    --cli-input-json file://repository-catalog-data.json \
    --region us-east-1
```
Isi dari `repository-catalog-data.json`:  

```
{
    "repositoryName": "project-a/nginx-web-app",
    "catalogData": {
        "description": "My project-a ECR Public Repository",
        "architectures": [
            "ARM",
            "ARM 64",
            "x86",
            "x86-64"
        ],
        "operatingSystems": [
            "Linux"
        ],
        "logoImageBlob": "iVBORw0KGgoA<<truncated-for-better-reading>>ErkJggg==",
        "aboutText": "## Quick reference.",
        "usageText": "## Supported architectures are as follows."
    }
}
```
Output:  

```
{
    "catalogData": {
        "description": "My project-a ECR Public Repository",
        "architectures": [
            "ARM",
            "ARM 64",
            "x86",
            "x86-64"
        ],
        "operatingSystems": [
            "Linux"
        ],
        "logoUrl": "https://d3g9o9u8re44ak.cloudfront.net/logo/df86cf58-ee60-4061-b804-0be24d97ccb1/4a9ed9b2-69e4-4ede-b924-461462d20ef0.png",
        "aboutText": "## Quick reference.",
        "usageText": "## Supported architectures are as follows."
    }
}
```
Untuk informasi selengkapnya, lihat [Data katalog repositori](https://docs.aws.amazon.com/AmazonECR/latest/public/public-repository-catalog-data.html) di *Amazon ECR* Public.  
+  Untuk detail API, lihat [PutRepositoryCatalogData](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/put-repository-catalog-data.html)di *Referensi AWS CLI Perintah*. 

### `set-repository-policy`
<a name="ecr-public_SetRepositoryPolicy_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`set-repository-policy`.

**AWS CLI**  
**Contoh 1: Untuk menyetel kebijakan repositori agar memungkinkan penarikan pada repositori**  
`set-repository-policy`Contoh berikut menerapkan kebijakan repositori publik ECR ke repositori yang ditentukan untuk mengontrol izin akses.  

```
aws ecr-public set-repository-policy \
    --repository-name project-a/nginx-web-app \
    --policy-text file://my-repository-policy.json
```
Isi dari `my-repository-policy.json`:  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement" : [
        {
            "Sid" : "allow public pull",
            "Effect" : "Allow",
            "Principal" : "*",
            "Action" : [
                "ecr:BatchCheckLayerAvailability",
                "ecr:BatchGetImage",
                "ecr:GetDownloadUrlForLayer"
            ]
        }
    ]
}
```
Output:  

```
{
    "registryId": "12345678901",
    "repositoryName": "project-a/nginx-web-app",
    "policyText": "{\n  \"Version\" : \"2008-10-17\",\n  \"Statement\" : [ {\n    \"Sid\" : \"allow public pull\",\n    \"Effect\" : \"Allow\",\n    \"Principal\" : \"*\",\n    \"Action\" : [ \"ecr:BatchCheckLayerAvailability\", \"ecr:BatchGetImage\", \"ecr:GetDownloadUrlForLayer\" ]\n  } ]\n}"
}
```
Untuk informasi selengkapnya, lihat [Menyetel pernyataan kebijakan repositori](https://docs.aws.amazon.com/AmazonECR/latest/public/public-repository-policy-examples.html) di Panduan Pengguna *Publik Amazon ECR*.  
**Contoh 2: Untuk menetapkan kebijakan repositori untuk mengizinkan pengguna IAM dalam akun Anda untuk mendorong gambar**  
`set-repository-policy`Contoh berikut memungkinkan pengguna IAM dalam akun Anda untuk mendorong gambar menggunakan ke repositori ECR di AWS akun Anda menggunakan file input bernama `file://my-repository-policy.json` teks kebijakan.  

```
aws ecr-public set-repository-policy \
    --repository-name project-a/nginx-web-app \
    --policy-text file://my-repository-policy.json
```
Isi dari `my-repository-policy.json`:  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowPush",
            "Effect": "Allow",
            "Principal": {
                "AWS": [
                    "arn:aws:iam::account-id:user/push-pull-user-1",
                    "arn:aws:iam::account-id:user/push-pull-user-2"
                ]
            },
            "Action": [
                "ecr-public:BatchCheckLayerAvailability",
                "ecr-public:PutImage",
                "ecr-public:InitiateLayerUpload",
                "ecr-public:UploadLayerPart",
                "ecr-public:CompleteLayerUpload"
            ]
        }
    ]
}
```
Output:  

```
{
    "registryId": "12345678901",
    "repositoryName": "project-a/nginx-web-app",
    "policyText": "{\n  \"Version\" : \"2008-10-17\",\n  \"Statement\" : [ {\n    \"Sid\" : \"AllowPush\",\n    \"Effect\" : \"Allow\",\n    \"Principal\" : {\n      \"AWS\" : [ \"arn:aws:iam::12345678901:user/admin\", \"arn:aws:iam::12345678901:user/eksuser1\" ]\n    },\n    \"Action\" : [ \"ecr-public:BatchCheckLayerAvailability\", \"ecr-public:PutImage\", \"ecr-public:InitiateLayerUpload\", \"ecr-public:UploadLayerPart\", \"ecr-public:CompleteLayerUpload\" ]\n  } ]\n}"
}
```
Untuk informasi selengkapnya, lihat [Menyetel pernyataan kebijakan repositori](https://docs.aws.amazon.com/AmazonECR/latest/public/public-repository-policy-examples.html) di Panduan Pengguna *Publik Amazon ECR*.  
**Contoh 3: Untuk menetapkan kebijakan repositori untuk mengizinkan pengguna IAM dari akun yang berbeda untuk mendorong gambar**  
`set-repository-policy`Contoh berikut memungkinkan akun tertentu untuk mendorong gambar menggunakan file input cli://my-repository-policy.json di akun Anda. AWS   

```
aws ecr-public set-repository-policy \
    --repository-name project-a/nginx-web-app \
    --policy-text file://my-repository-policy.json
```
Isi dari `my-repository-policy.json`:  

```
 {
     "Version":"2012-10-17",		 	 	 
     "Statement": [
         {
             "Sid": "AllowCrossAccountPush",
             "Effect": "Allow",
             "Principal": {
                 "AWS": "arn:aws:iam::other-or-same-account-id:role/RoleName"
             },
             "Action": [
                 "ecr-public:BatchCheckLayerAvailability",
                 "ecr-public:PutImage",
                 "ecr-public:InitiateLayerUpload",
                 "ecr-public:UploadLayerPart",
                 "ecr-public:CompleteLayerUpload"
             ]
         }
     ]
}
```
Output:  

```
{
    "registryId": "12345678901",
    "repositoryName": "project-a/nginx-web-app",
    "policyText": "{\n  \"Version\" : \"2008-10-17\",\n  \"Statement\" : [ {\n    \"Sid\" : \"AllowCrossAccountPush\",\n    \"Effect\" : \"Allow\",\n    \"Principal\" : {\n      \"AWS\" : \"arn:aws:iam::12345678901:role/RoleName\"\n    },\n    \"Action\" : [ \"ecr-public:BatchCheckLayerAvailability\", \"ecr-public:PutImage\", \"ecr-public:InitiateLayerUpload\", \"ecr-public:UploadLayerPart\", \"ecr-public:CompleteLayerUpload\" ]\n  } ]\n}"
}
```
Untuk informasi selengkapnya, lihat [contoh kebijakan repositori publik](https://docs.aws.amazon.com/AmazonECR/latest/public/public-repository-policy-examples.html) di Panduan Pengguna *Publik Amazon ECR*.  
+  Untuk detail API, lihat [SetRepositoryPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/set-repository-policy.html)di *Referensi AWS CLI Perintah*. 

### `tag-resource`
<a name="ecr-public_TagResource_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`tag-resource`.

**AWS CLI**  
**Contoh 1: Untuk menandai repositori publik yang ada di registri publik**  
`tag-resource`Contoh berikut tag repositori bernama `project-a/nginx-web-app` dalam registri publik.  

```
aws ecr-public tag-resource \
    --resource-arn arn:aws:ecr-public::123456789012:repository/project-a/nginx-web-app \
    --tags Key=stack,Value=dev \
    --region us-east-1
```
Untuk informasi selengkapnya, lihat [Menggunakan Tag untuk repositori publik](https://docs.aws.amazon.com/AmazonECR/latest/public/ecr-public-using-tags.html) di *Amazon ECR* Public.  
**Contoh 2: Untuk menandai repositori publik yang ada dengan beberapa tag dalam registri publik.**  
`tag-resource`Contoh berikut menandai repositori yang ada dengan beberapa tag.  

```
aws ecr-public tag-resource \
    --resource-arn arn:aws:ecr-public::890517186334:repository/project-a/nginx-web-app  \
    --tags Key=key1,Value=value1 Key=key2,Value=value2 Key=key3,Value=value3 \
    --region us-east-1
```
Untuk informasi selengkapnya, lihat [Menggunakan Tag untuk repositori publik](https://docs.aws.amazon.com/AmazonECR/latest/public/ecr-public-using-tags.html) di *Amazon ECR* Public.  
+  Untuk detail API, lihat [TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/tag-resource.html)di *Referensi AWS CLI Perintah*. 

### `untag-resource`
<a name="ecr-public_UntagResource_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`untag-resource`.

**AWS CLI**  
**Contoh 1: Untuk menghapus tag repositori publik yang ada di registri publik**  
`untag-resource`Contoh berikut tag repositori bernama `project-a/nginx-web-app` dalam registri publik.  

```
aws ecr-public untag-resource \
    --resource-arn arn:aws:ecr-public::123456789012:repository/project-a/nginx-web-app \
    --tag-keys stack \
    --region us-east-1
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Menggunakan Tag untuk repositori publik](https://docs.aws.amazon.com/AmazonECR/latest/public/ecr-public-using-tags.html) di *Amazon ECR* Public.  
+  Untuk detail API, lihat [UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecr-public/untag-resource.html)di *Referensi AWS CLI Perintah*. 