0

好的,所以我知道如何从目录下的所有 jar 中删除类文件。但是,现在我有一个与 docker 图像不同的层,每一层都是一个 tar 文件,并且在 tar 文件中有 jar 文件。

我可以从打包在 tar 文件中的 jar 文件中删除类文件吗?

$ tree -L 3
.
├── 29e0fb8afe376cb02219c977cba1c9a80cca895f7f17b72c356f3e25a63337b9
│   ├── json
│   ├── layer.tar
│   └── VERSION
├── 3b75d6634da4d4f4932d2affeabb7454dc51ba160c3833b386c34e328da8f0ba
│   ├── amq                                               # <<<<< this layer is extracted already, and you can see all the jars here. Other layers are not
│   │   ├── activemq-all-5.11.0.redhat-630495.jar
│   │   ├── bin
│   │   ├── conf
│   │   ├── data
│   │   ├── docs
│   │   ├── examples
│   │   ├── lib
│   │   ├── LICENSE
│   │   ├── NOTICE
│   │   ├── README.txt
│   │   ├── webapps
│   │   └── webapps-demo
│   ├── json
│   ├── layer.tar
│   ├── temp
│   └── VERSION
├── c1fa0e994b2d29f60fd2a6caecbe1ac3f987d001903523d60e532b6e08b094f0
│   ├── json
│   ├── layer.tar
│   └── VERSION
├── c8c84a6c1be5bdfc8caafd23082fd725e84f1c9cddb98fd56cad3a62544b2a3c.json
├── ef5088f89fbac64d2d5982ba14492227f60db1221f6bfd6290c6364a2a95a7e3
│   ├── json
│   ├── layer.tar
│   └── VERSION
├── manifest.json
├── repositories
└── script.sh                                             # <<<<< the script is here


那你问我为什么?好吧,你最近听到人们谈论 log4j 了吗?:) 我现在正在这样做:log4j 漏洞检查:如何在 mavevn/图像中快速检测是否使用了 log4j?“mvn dependency:tree”没有给出完整的图片

如果有人能告诉我如何从 jib maven 插件中删除这些类,那就更好了。它们来自基本图像,但我怀疑我们能否做到这一点。

4

0 回答 0