Docker Scan 是一个命令行接口,可用于在 Dockerfile 和 Docker 映像上运行漏洞检测。
Docker Scan 是一个命令行接口,可用于在 Dockerfile 和 Docker 映像上运行漏洞检测。
:warning:
The docker scan command has been removed.
To continue learning about the vulnerabilities of your images, and many other features, use the new docker scout command.
Run docker scout --help, or learn more at https://docs.docker.com/engine/reference/commandline/scout/
Docker Scan is a Command Line Interface to run vulnerability detection on your Dockerfiles and Docker images.
You need to be logged into the Docker Hub in order to use the docker scan command.
Docker Scan works with third party providers to detect vulnerabilities,
the plugin will ask for your consent before sending any data to the provider.
$ docker scan hello-world
? Docker Scan relies upon access to Snyk a third party provider, do you consent to proceed using Snyk? (y/N)Docker Scan allows you to scan existing Docker images by name or ID.
docker scan DOCKER_IMAGE:$ docker scan hello-world
Testing hello-world...
Organization: docker-desktop-test
Package manager: linux
Project name: docker-image|hello-world
Docker image: hello-world
Licenses: enabled
✓ Tested 0 dependencies for known issues, no vulnerable paths found.
Note that we do not currently have vulnerability data for your image.If you want more details, you can provide the Dockerfile used to create the image
docker scan -f PATH_TO_DOCKERFILE DOCKER_IMAGEIf we apply the option to the current repository, we have:
…When using the scan command with the -f flag, you can exclude the base image (i.e.: that specified in the Dockerfile with the FROM directive) vulnerabilities from your report by adding the --exclude-base tag.
…You can also display the scan result as a JSON output by adding the --json flag to the command:
…In addition to the --json flag, you can use the --group-issues flag to display only once a vulnerability
…You can find all the sources of the vulnerability in the from section.
If you want to see the dependency tree of your image, you can use the --dependency-tree flag, to display all the dependencies before the scan result
…If you want to only display some level of vulnerabilities, the --severity flag allows you to choose between 3 levels of
vulnerabilities low,medium or high. By using this tag you will only report vulnerabilities of the provided level
or higher.
…If you have an existing Snyk account, you can directly use your auth token
$ docker scan --login --token PROVIDER_AUTH_TOKENYou need to get a Snyk API token and then use it like this
$ docker scan --login --token c68dc480-27bd-45ee-9f5c-XXXXXXXXXXXX
Your account has been authenticated. Snyk is now ready to be used.If you use the --login command without any token, you will be redirected to the Snyk website to login.
Docker Desktop comes with Docker scan already installed. Just try to use the plugin, open a terminal and write the following command:
…If you get the following error message, you're not using the latest version of Docker Desktop
docker: 'scan' is not a docker command.
Docker packaging on Linux comes with Docker scan plugin. You can simply install Docker following the standard linux install
Just try to use the plugin, open a terminal and type the following command:
$ docker scan
Usage: docker scan [OPTIONS] IMAGEIf you get the following error message, you're not using the latest version of Docker on Linux
docker: 'scan' is not a docker command.
Alternatively, you can manually install the scan docker plugin on top of your existing docker setup :
Download the binary from the latest release and copy it in the cli-plugins directory
mkdir -p ~/.docker/cli-plugins && \
curl https://github.com/docker/scan-cli-plugin/releases/latest/download/docker-scan_linux_amd64 -L -s -S -o ~/.docker/cli-plugins/docker-scan &&\
chmod +x ~/.docker/cli-plugins/docker-scanYou'll find all the commands to build, run and test Docker Scan inside the BUILDING.md file.
Want to contribute to Docker Scan? Awesome!
First be sure to read the Code of conduct.
You can find information about contributing to this project in the CONTRIBUTING.md
暂无开放 Issues,或尚未同步最近议题。