DEV Community

Pooya Golchian
Pooya Golchian

Posted on • Edited on

How to pull the AWS ECR docker image and extract all things in the docker image?

Intro

Maybe you faced the problem that you have been needed the old docker file in the ECR repository.
I solved this problem with the docker command to pull and extract the docker image and access all I need.

Pulling Docker image file

You can use the below command to pull the docker image that you push in the ECR repository:



docker pull YOUR_DOCKER_IMAGE_URL


Enter fullscreen mode Exit fullscreen mode

Run your desire command in docker image

You can run and execute a command in your docker image:



docker run --rm -it --entrypoint=/bin/bash YOUR_DOCKER_IMAGE_URL


Enter fullscreen mode Exit fullscreen mode

For example:



docker run --rm -it --entrypoint=/bin/bash YOUR_DOCKER_IMAGE_URL ls -la


Enter fullscreen mode Exit fullscreen mode

Extract Docker image and searching in the files



 docker image save YOUR_DOCKER_IMAGE_URL > img.tar


Enter fullscreen mode Exit fullscreen mode

After that, you extract the docker image and find your target files:



 tar -xvf img.tar


Enter fullscreen mode Exit fullscreen mode

Image description

Top comments (0)