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.

1
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:

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