ECR + AWS App Runner: Step by Step
1. Prerequisite
Make sure you have Docker Desktop installed.
Warning
The
homebrew
version ofdocker-compose
requiresvirtualbox
, and will not work on Apple Silicon computers.
Ensure aws-cli
is installed and configured
You’ll need your account_key_id
& secret_access_key
from the AWS console.
Log docker client into AWS ECR with aws ecr get-login-password --region __region__ | docker login --username AWS --password-stdin __aws_account_id__.dkr.ecr.__region__.amazonaws.com
For example:
2. Set up ECR
Create your private repository for your project in the AWS console, and note down the repository_name
.
3. Build Your Application
Build the Docker image
Tag the local Docker image with the ECR repository name & tags using: docker tag __IMAGE ID__ __aws_account_id__.dkr.ecr._region_.amazonaws.com/__repository_name__:__tag__
For example:
4. Push Dockerised Application to ECR Repository
Push the images to ECR using docker push __repository__:__tag__
Verify that the docker image is pushed to ECR from the AWS console
5. Run Application w/ App Runner
Head to the App Runner Console once the Docker image is up in ECR. Make sure you choose the same region as the ECR. You should be able to find the image from the dropdown if you have selected the same AWS region.
Following the Creating App Runner Service step-by-step guide.
Local Development with docker compose
Troubleshooting
AWS ECS/ECS exec /usr/local/bin/docker-entrypoint.sh: exec format error
If you build your docker image on an Apple M1/M2 machine, this error may occur. To fix the issue, use:
Private
-----BEGIN PGP MESSAGE----- hQIOAxdwc3QWykEfEAgA1kHF/7oJaEbhwu3oDYCTFvLX0hrS2T/h41sqG6V1YSud jYzawvAnLgLhuxW1zYAADVssoII5Fih/yWg4rKR3dJ25kXt4cllK3sjsOhCk4KOK j2j5FIU9SbFJlIs68wj6rO/9OVuPiLq3OVbn8XvQ4hJMduebmk2mp/N4iEcHymKD JMYa/FrsUAljoQ8JPb9Hh+rOgcnbfjoA80VgWbVqU5qGnWp8OG1fydZWhwQzyCF8 oDXGTS8wgh5gFg2U4LTvW5hP2UfeD1NNFj12ZTFCi9Zs5lrWTQnL3oo4gpXJ0LPr Ce6HAYTOh//l4mgyCdrhV2FSgwLpJrl4N7Qv72kjawf/dsRAINfcsi8xeWzlBuvQ 0je6uc/JNBYdTjFVXTlfKHT4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