MiniBank runs as four custom Docker images (a website, two APIs and a notifier) plus ready-made PostgreSQL and Redis images. Images that only exist on one laptop can't be run by Kubernetes or OpenShift anywhere else, so as part of the DevOps and container platforms course at Execute Tech Academy, I pushed all four, tagged 1.0, to a private Amazon ECR registry. These are the commands I used, in PowerShell with the AWS CLI.

Logging in, without keys in the code

The AWS CLI keeps the access keys in the user's own .aws/credentials file, set once with aws configure, so they never go near the project or Git. A few variables then save typing the long registry address again and again:

$REGION   = "<region>"
$ME       = "<aws-username>"
$ACCOUNT  = aws sts get-caller-identity --query Account --output text
$REGISTRY = "$ACCOUNT.dkr.ecr.$REGION.amazonaws.com"
$TAG      = "1.0"
$SERVICES = "frontend","accounts-api","transactions-api","notifier"

1. One repository per service, scanned on push

Each image gets its own ECR repository, prefixed with my username so it can't clash with anyone else's in the shared account. scanOnPush=true makes AWS check every pushed image for known vulnerabilities.

foreach ($svc in $SERVICES) {
  aws ecr create-repository `
    --repository-name "$ME/minibank-$svc" `
    --region $REGION `
    --image-scanning-configuration scanOnPush=true
}

2. A temporary login for Docker

Docker needs a password to push to a private registry. AWS hands out a temporary one, piped straight into docker login so it's never typed or saved. It lasts 12 hours.

aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY

3. Tag and push

Tagging gives each local image its registry address; pushing uploads it. Images share base layers, so many layers show Layer already exists and only what's new is uploaded.

foreach ($svc in $SERVICES) {
  docker tag  "minibank/${svc}:$TAG" "$REGISTRY/$ME/minibank-${svc}:$TAG"
  docker push "$REGISTRY/$ME/minibank-${svc}:$TAG"
}

4. Check the images and the scan results

aws ecr describe-image-scan-findings --repository-name "$ME/minibank-$svc" `
  --image-id imageTag=$TAG --region $REGION `
  --query "imageScanFindings.findingSeverityCounts"

What it gave me

The four images now live in a private registry instead of on one machine, every push is checked for known vulnerabilities, and the same 1.0 tags are ready to be pulled by Kubernetes and OpenShift in the next steps.