Registries are the places where docker retrieves the images used to run containers. By default docker interacts with DockerHub’s public registry instance.
HakunaCloud detects automatically if it’s required to login into a private registry to run the specified container.
That’s the command to add a Docker Hub private registry:
1
hakuna registry add -u <username> -p <password>
This command instead will store credentials for an ECR private registry:
1
hakuna registry add -u <AWS_ACCESS_KEY_ID> -p <AWS_SECRET_ACCESS_KEY> -s <server>
The additional <server>
parameter must be the registry URI.
You can find the URI on ECR’s repositories list (the main ECR page), here it’s shown the structure:
1
<account_id>.dkr.ecr.<region>.amazonaws.com
and here an example:
1
hakuna registry add -u 123456789 -p abcdefg -s 123456789012.dkr.ecr.us-west-1.amazonaws.com
Make sure that the provided access_key_id and secret_access_key reference an account with (at least) the following IAM permissions:
ecr:GetDownloadUrlForLayer
ecr:BatchGetImage
ecr:BatchCheckLayerAvailability
To learn more, check out official AWS documentation to manage IAM permissions and a see some examples.
1
hakuna registry ls
1
hakuna registry rm <server>
Keep in mind that to remove Docker Hub’s registry, the <server>
parameter is simply dockerhub
.