Check the contents by docker pull from ECR and start the container

In the configuration where I saved the Docker image in Amazon ECR and deployed it to Fargate with AWS CodePipeline, the deployment failed. There seems to be something wrong with the container, so I want to check the container. In that situation, I dropped the Docker image from ECR and wanted to check it, but I always forget how to do it, so I will leave it as a memorandum.

Docker pull from ECR

$ docker pull your-aws-account-id.dkr.ecr.ap-northeast-1.amazonaws.com/xxx/yyy/zzz:latest

When I executed the above command, an authentication error occurred. (Select the URL of the image by selecting ECR in the AWS console)

https://docs.aws.amazon.com/ja_jp/AmazonECR/latest/userguide/Registries.html#registry_auth If you check here, it seems that registry authentication is required.

$ aws ecr get-login-password --region ap-northeast-1 | docker login --username AWS --password-stdin your-aws-account-id.dkr.ecr.ap-northeast-1.amazonaws.com

Log in with this. Note that there was no get-login-password in aws cli v1. It may be necessary to set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN in the environment variables in advance.

If this succeeds, re-execute the docker pull and it will succeed.

Launch the docker pulled image

$ docker images

First, check that the image has been added with the above command.

$ docker run -it your-aws-account-id.dkr.ecr.ap-northeast-1.amazonaws.com/xxx/yyy/zzz:latest /bin/bash

Finally, enter / bin/bash to put it in the container with bash. Feel free to do the rest.

Recommended Posts

Check the contents by docker pull from ECR and start the container
[Docker] Check the running container and enter there
Copy and paste the file contents in Ubuntu's Docker container
Until you build the docker environment and start / stop the Ubuntu container
Recreate the container and then start it
[Docker] Start the container as soon as possible
Push the Docker Image distributed by Docker Hub to Google Container Registry and start the VM based on that Image
How to check the logs in the Docker container
Get Enum by reverse lookup from the contents
How to mount the batch file location via WSL2 and start the Docker container
Automatically start the container
[Docker] How to see the contents of Volumes. Start a container with root privileges.
Communicate from the outside to the container launched by docker-compose
Check the rate limit application status of docker pull
Wait for the container service to start with docker healthcheck
Get only the ID of the container specified by docker ps
[Docker] How to access the host from inside the container. http://host.docker.internal:
Create a calendar from the Calendar class by specifying the year and month
Pg_resetwal can be used to start the PostgreSQL Docker container when WAL is broken and cannot be started.
[Linux] Start Apache container with Docker
About Docker, disguise server and container
Wait for PostgreSQL to start with Docker and then start the WEB service
The value is taken out from the double hash and output by the getter.
Run x11 apps in a Docker container (supports network access from the container)
Check when the container cannot be accessed from Host in the Laravel on docker environment using VS Code's Remote container.