Amazon Linux Container Image
The Amazon Linux container image is built from the same software components that are included in the Amazon Linux AMI, and it is available for use in any environment as a base image for Docker workloads. If you are already using the Amazon Linux AMI for applications in Amazon EC2, then you can easily containerize your applications with the Amazon Linux container image.
You can use the Amazon Linux container image in your local development environment and then push your application to the AWS cloud using Amazon ECS. For more information, see Using Amazon ECR Images with Amazon ECS.
Support for the Amazon Linux container image can be found by visiting the AWS developer forums.
To pull the Amazon Linux container image from Amazon ECR
Authenticate your Docker client to the Amazon Linux container image Amazon ECR registry. Authentication tokens are valid for 12 hours. For more information, see Registry Authentication. Specify the region that you would like to pull the image from (if you are unsure, the
us-west-2
region used in the command below is fine). If you do not use theus-west-2
region for the following command, be sure to change the region in the subsequent commands and image tags.$
aws ecr get-login --region
docker login -u AWS -pus-west-2
--registry-ids 137112412989password
-e none https://137112412989.dkr.ecr.us-west-2
.amazonaws.comThe resulting output is a docker login command that you use to authenticate your Docker client to the Amazon Linux container image Amazon ECR registry.
Copy and paste the docker login command into a terminal to authenticate your Docker CLI to the registry.
Important
When you execute this docker login command, the command string can be visible by other users on your system in a process list (ps -e) display. Because the docker login command contains authentication credentials, there is a risk that other users on your system could view them this way and use them to gain push and pull access to your repositories. If you are not on a secure system, you should consider this risk and log in interactively by omitting the
-p
option, and then entering the password when prompted.password
(Optional) You can list the images within the Amazon Linux repository with the aws ecr list-images command. The
latest
tag always corresponds with the latest Amazon Linux container image that is available.$
aws ecr list-images --region
us-west-2
--registry-id 137112412989 --repository-name amazonlinuxPull the Amazon Linux container image using the docker pull command.
$
docker pull 137112412989.dkr.ecr.
latest: Pulling from amazonlinux e2daa1633485: Pull complete Digest: sha256:939657b06a824c58f1532b104ba423c0c5efc16552c01427d96e9da20f8b2680 Status: Downloaded newer image for 137112412989.dkr.ecr.us-west-2.amazonaws.com/amazonlinux:latestus-west-2
.amazonaws.com/amazonlinux:latest(Optional) Run the container locally.
$
docker run -it 137112412989.dkr.ecr.
bash-4.2#us-west-2
.amazonaws.com/amazonlinux:latest /bin/bash