Differences
This shows you the differences between two versions of the page.
— |
linux_wiki:ec2_ecr_credential_helper [2019/07/11 22:23] (current) billdozor created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== EC2: ECR Credential Helper ====== | ||
+ | |||
+ | **General Information** | ||
+ | |||
+ | The Elastic Container Registry credential helper allows you to run docker pull/push commands without needing to login to an ECR from an EC2 instance. | ||
+ | |||
+ | Pre-reqs | ||
+ | * Role: The role attached to your ec2 instance requires appropriate access to the ECR. | ||
+ | * AMI: Amazon Linux 2 | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ====== Credential Helper Setup ====== | ||
+ | |||
+ | * Enable the Amazon Linux Extras Docker Repo< | ||
+ | * Install< | ||
+ | * Create docker dir for ECR credential helper< | ||
+ | * Create the credential helper config file< | ||
+ | |||
+ | { | ||
+ | " | ||
+ | }</ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Ansible Tasks Version ===== | ||
+ | |||
+ | These tasks can be included in an Ansible role/ | ||
+ | command: " | ||
+ | | ||
+ | - name: Install Amazon ECR Credential Helper | ||
+ | yum: | ||
+ | lock_timeout: | ||
+ | name: " | ||
+ | state: present | ||
+ | |||
+ | - name: Create docker dir for ECR credential helper | ||
+ | file: | ||
+ | path: "/ | ||
+ | state: directory | ||
+ | owner: ec2-user | ||
+ | group: ec2-user | ||
+ | mode: 0700 | ||
+ | |||
+ | - name: Deploy config.json for ECR credential helper | ||
+ | copy: | ||
+ | src: " | ||
+ | dest: "/ | ||
+ | owner: ec2-user | ||
+ | group: ec2-user | ||
+ | mode: 0600</ | ||
+ | |||
+ | \\ | ||
+ | Credential Helper File contents(docker-ecr-cred-helper-config.json) | ||
+ | <code json> | ||
+ | { | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ---- | ||