I want update image tag in tar before load it (this is the requirement).
For example I pull alpine:latest:
docker pull alpine:latest
docker save alpine:latest -o alpine.tar
tar -tf alpine.tar showed:
9368795fa2bb66d464c5637fb9f6747be3e9473e923af3f06e70268a5feb00ae/
9368795fa2bb66d464c5637fb9f6747be3e9473e923af3f06e70268a5feb00ae/VERSION
9368795fa2bb66d464c5637fb9f6747be3e9473e923af3f06e70268a5feb00ae/json
9368795fa2bb66d464c5637fb9f6747be3e9473e923af3f06e70268a5feb00ae/layer.tar
f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418.json
manifest.json
repositories
Now, after I tar --delete -f alpine.tar manifest.json (before I add the new manifest.json) it's shows:
9368795fa2bb66d464c5637fb9f6747be3e9473e923af3f06e70268a5feb00ae/
9368795fa2bb66d464c5637fb9f6747be3e9473e923af3f06e70268a5feb00ae/VERSION
9368795fa2bb66d464c5637fb9f6747be3e9473e923af3f06e70268a5feb00ae/json
9368795fa2bb66d464c5637fb9f6747be3e9473e923af3f06e70268a5feb00ae/layer.tar
Other files (as well as manifest.json) deleted, why is that?
As @RogerLipscombe mention in a comment, this seems like a bug in
tar. However, it looks like it only manifests when operating on a file in place; when usingtaras a streaming filter, it seems to work as expected:To accomplish your original goal: