如何在 Windows 10 中安装 grype

1 installation docker windows-10

我想在 Windows 10 中安装Grype,但发现很难按照指示安装。如果获得grype在windows 10中的安装过程将会很有帮助。安装后我想运行grype <image> --scope all-layers这个命令来找出docker镜像的漏洞。

小智 5

可以通过 Windows 10 的 wsl 2 安装\n https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux

\n

(我个人发现它比 docker 版本更好,快了大约 30-40%,但这可能只是我的本地机器)

\n

指示:

\n
    \n
  1. 安装适用于 Windows 10 的 wsl 2

    \n

    更多信息:https ://docs.microsoft.com/en-us/windows/wsl/install-win10

    \n
  2. \n
  3. 通过 wsl 2 中的脚本将 grype 安装到本地安装目录

    \n
    curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /mnt/c/xxx\n\n# in my case /mnt/c/dev/bin/grype/ === "C:\\dev\\bin\\grype"\ncurl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /mnt/c/dev/bin/grype/\n
    Run Code Online (Sandbox Code Playgroud)\n

    更多信息: https: //github.com/anchore/grype#installation

    \n
  4. \n
  5. 将安装 grype 的路径添加到您的 PATH 中(对我来说是“C:\\dev\\bin\\grype”)

    \n

    更多信息:https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/

    \n
  6. \n
  7. 在 Windows 上的 wsl 2 linux 中打开 grype

    \n
  8. \n
\n

结果:

\n
local@DESKTOP-GPVF0RR:~$ grype version\nApplication:          grype\nVersion:              0.13.0\nBuildDate:            2021-06-02T01:57:12Z\nGitCommit:            3d21b8397d65770d292184b09a4f676bce6f3ec8\nGitTreeState:         clean\nPlatform:             linux/amd64\nGoVersion:            go1.16.4\nCompiler:             gc\nSupported DB Schema:  3\n
Run Code Online (Sandbox Code Playgroud)\n

带扫描

\n
local@DESKTOP-GPVF0RR:~$ grype python --scope all-layers\n \xe2\x9c\x94 Vulnerability DB        [updated]\n \xe2\x9c\x94 Parsed image\n \xe2\x9c\x94 Cataloged packages      [1349 packages]\n \xe2\x9c\x94 Scanned image           [4054 vulnerabilities]\nNAME                          INSTALLED                     FIXED-IN               VULNERABILITY     SEVERITY\napt                           1.8.2.3                                              CVE-2011-3374     Negligible\nbash                          5.0-4                                                CVE-2019-18276    Negligible\nbinutils                      2.31.1-16                                            CVE-2018-18483    Negligible\n....\n
Run Code Online (Sandbox Code Playgroud)\n