How to Extract the Files in a Docker Image

0 min read 97 words

Ever needed to extract the files in a Docker container?

Docker provides the save sub-command.

Exporting Docker files into a Tar Archive

The examples below use a Docker container called: aoms/hellojava

Swap this out with your own container as required.

docker save aoms/hellojava > hellojava.tar

hellojava.tar now contains a list of files found in the Docker image.

Taking it one step further

You can make this a bit better by extracting it into a new directory and untarring automatically:

mkdir tmpimage && cd $_ && docker save aoms/hellojava > _out.tar && tar -xvf _out.tar && open .
Tags:
Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags