If storing the full output of
docker save isn't an option, you could use pipelines to extract just the needed file from it.
Unfortunately, because the output is a "tar of tars", it can be a slightly iterative process.
What I did when I needed to extract a file just now was:
Determine which version of the image the file you are interested in changed most recently (how you do this probably depends on your image), and the date it was created / saved
Get the full table of contents from the output of the
docker save command with:
docker save IMAGE_NAME | tar -tvf -
layer.tar file(s) in the output of that command that match the date of the image that you determined in step 1. (you can add
| grep layer.tar to just show those files)
layer.tar file to standard out, and get the table of contents of it:
docker save IMAGE_NAME | tar -xf - -O CHECKSUM_FROM_LIST/layer.tar | tar -tvf -
Verify the file you want is listed, and extract it once you find the name:
docker save IMAGE_NAME | tar -xf - -O CHECKSUM_FROM_LIST/layer.tar | tar -xf - PATH/TO/YOUR/FILE
If there are more than one
layer.tar files matching the date you are looking for in step 2/3, you may need to repeat step 4 for each one of them until you find the right one
Replace the text in capitals in the commands above with the correct image names, checksums and filenames for your case.