Latest commit

History

190 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Docker Scout

Docker Scout is a set of software supply chain features integrated into Docker's user interfaces and command line interface (CLI). These features offer comprehensive visibility into the structure and security of container images. This repository contains installable binaries of the docker scout CLI plugin.

Usage

The CLI documentation is available in this repository.

See the reference documentation to learn about Docker Scout including Docker Desktop and Docker Hub integrations.

Environment Variables

The following environment variables are available to configure the Scout CLI:

NameFormatDescription
DOCKER_SCOUT_CACHE_FORMATStringFormat of the local image cache; can be oci or tar
DOCKER_SCOUT_CACHE_DIRStringDirectory where the local SBOM cache is stored
DOCKER_SCOUT_NO_CACHEBooleanDisable the local SBOM cache
DOCKER_SCOUT_OFFLINEBooleanOffline mode during SBOM indexing
DOCKER_SCOUT_REGISTRY_TOKENStringRegistry Access token to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_USERStringRegistry user name to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_PASSWORDStringRegistry password/PAT to authenticate when pulling images
DOCKER_SCOUT_HUB_USERStringDocker Hub user name to authenticate against the Docker Scout backend
DOCKER_SCOUT_HUB_PASSWORDStringDocker Hub password/PAT to authenticate against the Docker Scout backend
DOCKER_SCOUT_NEW_VERSION_WARNBooleanWarn about new versions of the Docker Scout CLI
DOCKER_SCOUT_EXPERIMENTAL_WARNBooleanWarn about experimental features
DOCKER_SCOUT_EXPERIMENTAL_POLICY_OUTPUTBooleanDisable experimental policy output

You can found further information about environment variables here.

CLI Plugin Installation

Docker Desktop

docker scout CLI plugin is available by default on Docker Desktop starting with version 4.17.

Manual Installation

To install it manually:

  • Download the docker-scout binary corresponding to your platform from the latest or other releases.
  • Uncompress it as
    • docker-scout on Linux and macOS
    • docker-scout.exe on Windows
  • Copy the binary to the scout directory
    • $HOME/.docker/scout on Linux and macOS
    • %USERPROFILE%\.docker\scout on Windows
  • Make it executable on Linux and macOS
    • chmod +x $HOME/.docker/scout/docker-scout
  • Authorize the binary to be executable on macOS
    • xattr -d com.apple.quarantine $HOME/.docker/scout/docker-scout
  • Add the scout directory to your .docker/config.json as a plugin directory
    • $HOME/.docker/config.json on Linux and macOS
    • %USERPROFILE%\.docker\config.json on Windows
    • Add the cliPluginsExtraDirs property to the config.json file
{
...
"cliPluginsExtraDirs": [
"<full path to the .docker/scout folder>"
],
...
}

Script Installation (macOS and Linux)

To install, run the following command in your terminal:

curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --

Run as container

A container image to run the Docker Scout CLI in containerized environments is available at docker/scout-cli.

CI Integration

Docker Scout CLI can be used in CI environments. See below for the various ways to integrate the CLI into your CI pipelines.

GitHub Action

An early prototype of running the Docker Scout CLI as part of a GitHub Action workflow is available at docker/scout-action.

The following GitHub Action workflow can be used as a template to integrate Docker Scout:

name: Dockeron:
push:
tags: [ "*" ]branches:
- 'main'pull_request:
branches: [ "**" ]env:
# Use docker.io for Docker Hub if emptyREGISTRY: docker.ioIMAGE_NAME: ${{ github.repository }}SHA: ${{ github.event.pull_request.head.sha || github.event.after }}jobs:
build:
runs-on: ubuntu-latestpermissions:
contents: readpackages: writesteps:
- name: Checkout repositoryuses: actions/checkout@v3with:
ref: ${{ env.SHA }}
- name: Setup Docker buildxuses: docker/setup-buildx-action@v2.5.0# Login against a Docker registry except on PR# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}uses: docker/login-action@v2.1.0with:
registry: ${{ env.REGISTRY }}username: ${{ secrets.DOCKER_USER }}password: ${{ secrets.DOCKER_PAT }}# Extract metadata (tags, labels) for Docker# https://github.com/docker/metadata-action
- name: Extract Docker metadataid: metauses: docker/metadata-action@v4.4.0with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}labels: | org.opencontainers.image.revision=${{ env.SHA }}tags: | type=edge,branch=$repo.default_branch type=semver,pattern=v{{version}} type=sha,prefix=,suffix=,format=short# Build and push Docker image with Buildx (don't push on PR)# https://github.com/docker/build-push-action
- name: Build and push Docker imageid: build-and-pushuses: docker/build-push-action@v4.0.0with:
context: .push: truetags: ${{ steps.meta.outputs.tags }}labels: ${{ steps.meta.outputs.labels }}cache-from: type=ghacache-to: type=gha,mode=max
- name: Docker Scoutid: docker-scoutif: ${{ github.event_name == 'pull_request' }}uses: docker/scout-action@dd36f5b0295baffa006aa6623371f226cc03e506with:
command: cvesimage: ${{ steps.meta.outputs.tags }}only-severities: critical,highexit-code: true

GitLab

Use the following pipeline definition as a template to get Docker Scout integrated in GitLab CI:

docker-build:
image: docker:lateststage: buildservices:
- docker:dindbefore_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY# Install curl and the Docker Scout CLI
- | apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdinscript:
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then tag="" echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" else tag=":$CI_COMMIT_REF_SLUG" echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"rules:
- if: $CI_COMMIT_BRANCHexists:
- Dockerfile

CircleCI

Use the following pipeline definition as a template to get Docker Scout integrated in CircleCI project:

version: 2.1jobs:
build:
docker:
- image: cimg/base:stableenvironment:
IMAGE_TAG: docker/scout-demo-service:lateststeps:
# Checkout the repository files
- checkout# Set up a separate Docker environment to run `docker` commands in
- setup_remote_docker:
version: 20.10.24# Install Docker Scout and login to Docker Hub
- run:
name: Install Docker Scoutcommand: | env curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /home/circleci/bin echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin# Build the Docker image
- run:
name: Build Docker imagecommand: docker build -t $IMAGE_TAG .# Run Docker Scout 
- run:
name: Scan image for CVEscommand: | docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,highworkflows:
build-docker-image:
jobs:
- build

Microsoft Azure DevOps Pipelines

Use the following pipeline definition as a template to get Docker Scout integrated in Azure DevOps Pipelines:

trigger:
- mainresources:
- repo: selfvariables:
tag: '$(Build.BuildId)'image: 'vonwig/nodejs-service'stages:
- stage: BuilddisplayName: Build imagejobs:
- job: BuilddisplayName: Buildpool:
vmImage: ubuntu-lateststeps:
- task: Docker@2displayName: Build an imageinputs:
command: builddockerfile: '$(Build.SourcesDirectory)/Dockerfile'repository: $(image)tags: | $(tag) - task: CmdLine@2displayName: Find CVEs on imageinputs:
script: | # Install the Docker Scout CLI curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- # Login to Docker Hub required for Docker Scout CLI docker login -u $(DOCKER_HUB_USER) -p $(DOCKER_HUB_PAT) # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves $(image):$(tag) --exit-code --only-severity critical,high

Jenkins

The following snippet can be added to a Jenkinsfile to install and analyze images:

 stage('Analyze image') {
steps {
// Install Docker Scout
sh 'curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /usr/local/bin'// Log into Docker Hub
sh 'echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin'// Analyze and fail on critical or high vulnerabilities
sh 'docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,high'
}
}

This example assume two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT.

Bitbucket

Use the following pipeline definition as a template to get Docker Scout integrated in Bitbucket Pipelines:

image: dockerpipelines:
default:
- step:
name: Buildservices:
- dockercaches:
- dockerscript:
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin $CI_REGISTRY# Install curl and the Docker Scout CLI
- | export DOCKER_BUILDKIT=0 apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin
- | export DEVELOPMENT_BRANCH="main" if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Bitbucket uses master by default, adjust if your default branch is different tag=":latest" echo "Running on default branch '$DEVELOPMENT_BRANCH': tag = 'latest'" else tag=":$BITBUCKET_COMMIT" echo "Running on branch '$BITBUCKET_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected  docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"definitions:
services:
docker:
memory: 2048# Optional: Increase if needed

This example assumes two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT, also is necessary more two secrets called CI_REGISTRY, CI_REGISTRY_IMAGE about registry info.

License

The Docker Scout CLI is licensed under the Terms and Conditions of the Docker Subscription Service Agreement.

About

Docker Scout CLI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Latest commit

History

190 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Docker Scout

Docker Scout is a set of software supply chain features integrated into Docker's user interfaces and command line interface (CLI). These features offer comprehensive visibility into the structure and security of container images. This repository contains installable binaries of the docker scout CLI plugin.

Usage

The CLI documentation is available in this repository.

See the reference documentation to learn about Docker Scout including Docker Desktop and Docker Hub integrations.

Environment Variables

The following environment variables are available to configure the Scout CLI:

NameFormatDescription
DOCKER_SCOUT_CACHE_FORMATStringFormat of the local image cache; can be oci or tar
DOCKER_SCOUT_CACHE_DIRStringDirectory where the local SBOM cache is stored
DOCKER_SCOUT_NO_CACHEBooleanDisable the local SBOM cache
DOCKER_SCOUT_OFFLINEBooleanOffline mode during SBOM indexing
DOCKER_SCOUT_REGISTRY_TOKENStringRegistry Access token to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_USERStringRegistry user name to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_PASSWORDStringRegistry password/PAT to authenticate when pulling images
DOCKER_SCOUT_HUB_USERStringDocker Hub user name to authenticate against the Docker Scout backend
DOCKER_SCOUT_HUB_PASSWORDStringDocker Hub password/PAT to authenticate against the Docker Scout backend
DOCKER_SCOUT_NEW_VERSION_WARNBooleanWarn about new versions of the Docker Scout CLI
DOCKER_SCOUT_EXPERIMENTAL_WARNBooleanWarn about experimental features
DOCKER_SCOUT_EXPERIMENTAL_POLICY_OUTPUTBooleanDisable experimental policy output

You can found further information about environment variables here.

CLI Plugin Installation

Docker Desktop

docker scout CLI plugin is available by default on Docker Desktop starting with version 4.17.

Manual Installation

To install it manually:

  • Download the docker-scout binary corresponding to your platform from the latest or other releases.
  • Uncompress it as
    • docker-scout on Linux and macOS
    • docker-scout.exe on Windows
  • Copy the binary to the scout directory
    • $HOME/.docker/scout on Linux and macOS
    • %USERPROFILE%\.docker\scout on Windows
  • Make it executable on Linux and macOS
    • chmod +x $HOME/.docker/scout/docker-scout
  • Authorize the binary to be executable on macOS
    • xattr -d com.apple.quarantine $HOME/.docker/scout/docker-scout
  • Add the scout directory to your .docker/config.json as a plugin directory
    • $HOME/.docker/config.json on Linux and macOS
    • %USERPROFILE%\.docker\config.json on Windows
    • Add the cliPluginsExtraDirs property to the config.json file
{
...
"cliPluginsExtraDirs": [
"<full path to the .docker/scout folder>"
],
...
}

Script Installation (macOS and Linux)

To install, run the following command in your terminal:

curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --

Run as container

A container image to run the Docker Scout CLI in containerized environments is available at docker/scout-cli.

CI Integration

Docker Scout CLI can be used in CI environments. See below for the various ways to integrate the CLI into your CI pipelines.

GitHub Action

An early prototype of running the Docker Scout CLI as part of a GitHub Action workflow is available at docker/scout-action.

The following GitHub Action workflow can be used as a template to integrate Docker Scout:

name: Dockeron:
push:
tags: [ "*" ]branches:
- 'main'pull_request:
branches: [ "**" ]env:
# Use docker.io for Docker Hub if emptyREGISTRY: docker.ioIMAGE_NAME: ${{ github.repository }}SHA: ${{ github.event.pull_request.head.sha || github.event.after }}jobs:
build:
runs-on: ubuntu-latestpermissions:
contents: readpackages: writesteps:
- name: Checkout repositoryuses: actions/checkout@v3with:
ref: ${{ env.SHA }}
- name: Setup Docker buildxuses: docker/setup-buildx-action@v2.5.0# Login against a Docker registry except on PR# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}uses: docker/login-action@v2.1.0with:
registry: ${{ env.REGISTRY }}username: ${{ secrets.DOCKER_USER }}password: ${{ secrets.DOCKER_PAT }}# Extract metadata (tags, labels) for Docker# https://github.com/docker/metadata-action
- name: Extract Docker metadataid: metauses: docker/metadata-action@v4.4.0with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}labels: | org.opencontainers.image.revision=${{ env.SHA }}tags: | type=edge,branch=$repo.default_branch type=semver,pattern=v{{version}} type=sha,prefix=,suffix=,format=short# Build and push Docker image with Buildx (don't push on PR)# https://github.com/docker/build-push-action
- name: Build and push Docker imageid: build-and-pushuses: docker/build-push-action@v4.0.0with:
context: .push: truetags: ${{ steps.meta.outputs.tags }}labels: ${{ steps.meta.outputs.labels }}cache-from: type=ghacache-to: type=gha,mode=max
- name: Docker Scoutid: docker-scoutif: ${{ github.event_name == 'pull_request' }}uses: docker/scout-action@dd36f5b0295baffa006aa6623371f226cc03e506with:
command: cvesimage: ${{ steps.meta.outputs.tags }}only-severities: critical,highexit-code: true

GitLab

Use the following pipeline definition as a template to get Docker Scout integrated in GitLab CI:

docker-build:
image: docker:lateststage: buildservices:
- docker:dindbefore_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY# Install curl and the Docker Scout CLI
- | apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdinscript:
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then tag="" echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" else tag=":$CI_COMMIT_REF_SLUG" echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"rules:
- if: $CI_COMMIT_BRANCHexists:
- Dockerfile

CircleCI

Use the following pipeline definition as a template to get Docker Scout integrated in CircleCI project:

version: 2.1jobs:
build:
docker:
- image: cimg/base:stableenvironment:
IMAGE_TAG: docker/scout-demo-service:lateststeps:
# Checkout the repository files
- checkout# Set up a separate Docker environment to run `docker` commands in
- setup_remote_docker:
version: 20.10.24# Install Docker Scout and login to Docker Hub
- run:
name: Install Docker Scoutcommand: | env curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /home/circleci/bin echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin# Build the Docker image
- run:
name: Build Docker imagecommand: docker build -t $IMAGE_TAG .# Run Docker Scout 
- run:
name: Scan image for CVEscommand: | docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,highworkflows:
build-docker-image:
jobs:
- build

Microsoft Azure DevOps Pipelines

Use the following pipeline definition as a template to get Docker Scout integrated in Azure DevOps Pipelines:

trigger:
- mainresources:
- repo: selfvariables:
tag: '$(Build.BuildId)'image: 'vonwig/nodejs-service'stages:
- stage: BuilddisplayName: Build imagejobs:
- job: BuilddisplayName: Buildpool:
vmImage: ubuntu-lateststeps:
- task: Docker@2displayName: Build an imageinputs:
command: builddockerfile: '$(Build.SourcesDirectory)/Dockerfile'repository: $(image)tags: | $(tag) - task: CmdLine@2displayName: Find CVEs on imageinputs:
script: | # Install the Docker Scout CLI curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- # Login to Docker Hub required for Docker Scout CLI docker login -u $(DOCKER_HUB_USER) -p $(DOCKER_HUB_PAT) # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves $(image):$(tag) --exit-code --only-severity critical,high

Jenkins

The following snippet can be added to a Jenkinsfile to install and analyze images:

 stage('Analyze image') {
steps {
// Install Docker Scout
sh 'curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /usr/local/bin'// Log into Docker Hub
sh 'echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin'// Analyze and fail on critical or high vulnerabilities
sh 'docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,high'
}
}

This example assume two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT.

Bitbucket

Use the following pipeline definition as a template to get Docker Scout integrated in Bitbucket Pipelines:

image: dockerpipelines:
default:
- step:
name: Buildservices:
- dockercaches:
- dockerscript:
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin $CI_REGISTRY# Install curl and the Docker Scout CLI
- | export DOCKER_BUILDKIT=0 apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin
- | export DEVELOPMENT_BRANCH="main" if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Bitbucket uses master by default, adjust if your default branch is different tag=":latest" echo "Running on default branch '$DEVELOPMENT_BRANCH': tag = 'latest'" else tag=":$BITBUCKET_COMMIT" echo "Running on branch '$BITBUCKET_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected  docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"definitions:
services:
docker:
memory: 2048# Optional: Increase if needed

This example assumes two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT, also is necessary more two secrets called CI_REGISTRY, CI_REGISTRY_IMAGE about registry info.

License

The Docker Scout CLI is licensed under the Terms and Conditions of the Docker Subscription Service Agreement.

About

Docker Scout CLI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

190 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Docker Scout

Docker Scout is a set of software supply chain features integrated into Docker's user interfaces and command line interface (CLI). These features offer comprehensive visibility into the structure and security of container images. This repository contains installable binaries of the docker scout CLI plugin.

Usage

The CLI documentation is available in this repository.

See the reference documentation to learn about Docker Scout including Docker Desktop and Docker Hub integrations.

Environment Variables

The following environment variables are available to configure the Scout CLI:

NameFormatDescription
DOCKER_SCOUT_CACHE_FORMATStringFormat of the local image cache; can be oci or tar
DOCKER_SCOUT_CACHE_DIRStringDirectory where the local SBOM cache is stored
DOCKER_SCOUT_NO_CACHEBooleanDisable the local SBOM cache
DOCKER_SCOUT_OFFLINEBooleanOffline mode during SBOM indexing
DOCKER_SCOUT_REGISTRY_TOKENStringRegistry Access token to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_USERStringRegistry user name to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_PASSWORDStringRegistry password/PAT to authenticate when pulling images
DOCKER_SCOUT_HUB_USERStringDocker Hub user name to authenticate against the Docker Scout backend
DOCKER_SCOUT_HUB_PASSWORDStringDocker Hub password/PAT to authenticate against the Docker Scout backend
DOCKER_SCOUT_NEW_VERSION_WARNBooleanWarn about new versions of the Docker Scout CLI
DOCKER_SCOUT_EXPERIMENTAL_WARNBooleanWarn about experimental features
DOCKER_SCOUT_EXPERIMENTAL_POLICY_OUTPUTBooleanDisable experimental policy output

You can found further information about environment variables here.

CLI Plugin Installation

Docker Desktop

docker scout CLI plugin is available by default on Docker Desktop starting with version 4.17.

Manual Installation

To install it manually:

  • Download the docker-scout binary corresponding to your platform from the latest or other releases.
  • Uncompress it as
    • docker-scout on Linux and macOS
    • docker-scout.exe on Windows
  • Copy the binary to the scout directory
    • $HOME/.docker/scout on Linux and macOS
    • %USERPROFILE%\.docker\scout on Windows
  • Make it executable on Linux and macOS
    • chmod +x $HOME/.docker/scout/docker-scout
  • Authorize the binary to be executable on macOS
    • xattr -d com.apple.quarantine $HOME/.docker/scout/docker-scout
  • Add the scout directory to your .docker/config.json as a plugin directory
    • $HOME/.docker/config.json on Linux and macOS
    • %USERPROFILE%\.docker\config.json on Windows
    • Add the cliPluginsExtraDirs property to the config.json file
{
...
"cliPluginsExtraDirs": [
"<full path to the .docker/scout folder>"
],
...
}

Script Installation (macOS and Linux)

To install, run the following command in your terminal:

curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --

Run as container

A container image to run the Docker Scout CLI in containerized environments is available at docker/scout-cli.

CI Integration

Docker Scout CLI can be used in CI environments. See below for the various ways to integrate the CLI into your CI pipelines.

GitHub Action

An early prototype of running the Docker Scout CLI as part of a GitHub Action workflow is available at docker/scout-action.

The following GitHub Action workflow can be used as a template to integrate Docker Scout:

name: Dockeron:
push:
tags: [ "*" ]branches:
- 'main'pull_request:
branches: [ "**" ]env:
# Use docker.io for Docker Hub if emptyREGISTRY: docker.ioIMAGE_NAME: ${{ github.repository }}SHA: ${{ github.event.pull_request.head.sha || github.event.after }}jobs:
build:
runs-on: ubuntu-latestpermissions:
contents: readpackages: writesteps:
- name: Checkout repositoryuses: actions/checkout@v3with:
ref: ${{ env.SHA }}
- name: Setup Docker buildxuses: docker/setup-buildx-action@v2.5.0# Login against a Docker registry except on PR# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}uses: docker/login-action@v2.1.0with:
registry: ${{ env.REGISTRY }}username: ${{ secrets.DOCKER_USER }}password: ${{ secrets.DOCKER_PAT }}# Extract metadata (tags, labels) for Docker# https://github.com/docker/metadata-action
- name: Extract Docker metadataid: metauses: docker/metadata-action@v4.4.0with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}labels: | org.opencontainers.image.revision=${{ env.SHA }}tags: | type=edge,branch=$repo.default_branch type=semver,pattern=v{{version}} type=sha,prefix=,suffix=,format=short# Build and push Docker image with Buildx (don't push on PR)# https://github.com/docker/build-push-action
- name: Build and push Docker imageid: build-and-pushuses: docker/build-push-action@v4.0.0with:
context: .push: truetags: ${{ steps.meta.outputs.tags }}labels: ${{ steps.meta.outputs.labels }}cache-from: type=ghacache-to: type=gha,mode=max
- name: Docker Scoutid: docker-scoutif: ${{ github.event_name == 'pull_request' }}uses: docker/scout-action@dd36f5b0295baffa006aa6623371f226cc03e506with:
command: cvesimage: ${{ steps.meta.outputs.tags }}only-severities: critical,highexit-code: true

GitLab

Use the following pipeline definition as a template to get Docker Scout integrated in GitLab CI:

docker-build:
image: docker:lateststage: buildservices:
- docker:dindbefore_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY# Install curl and the Docker Scout CLI
- | apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdinscript:
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then tag="" echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" else tag=":$CI_COMMIT_REF_SLUG" echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"rules:
- if: $CI_COMMIT_BRANCHexists:
- Dockerfile

CircleCI

Use the following pipeline definition as a template to get Docker Scout integrated in CircleCI project:

version: 2.1jobs:
build:
docker:
- image: cimg/base:stableenvironment:
IMAGE_TAG: docker/scout-demo-service:lateststeps:
# Checkout the repository files
- checkout# Set up a separate Docker environment to run `docker` commands in
- setup_remote_docker:
version: 20.10.24# Install Docker Scout and login to Docker Hub
- run:
name: Install Docker Scoutcommand: | env curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /home/circleci/bin echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin# Build the Docker image
- run:
name: Build Docker imagecommand: docker build -t $IMAGE_TAG .# Run Docker Scout 
- run:
name: Scan image for CVEscommand: | docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,highworkflows:
build-docker-image:
jobs:
- build

Microsoft Azure DevOps Pipelines

Use the following pipeline definition as a template to get Docker Scout integrated in Azure DevOps Pipelines:

trigger:
- mainresources:
- repo: selfvariables:
tag: '$(Build.BuildId)'image: 'vonwig/nodejs-service'stages:
- stage: BuilddisplayName: Build imagejobs:
- job: BuilddisplayName: Buildpool:
vmImage: ubuntu-lateststeps:
- task: Docker@2displayName: Build an imageinputs:
command: builddockerfile: '$(Build.SourcesDirectory)/Dockerfile'repository: $(image)tags: | $(tag) - task: CmdLine@2displayName: Find CVEs on imageinputs:
script: | # Install the Docker Scout CLI curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- # Login to Docker Hub required for Docker Scout CLI docker login -u $(DOCKER_HUB_USER) -p $(DOCKER_HUB_PAT) # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves $(image):$(tag) --exit-code --only-severity critical,high

Jenkins

The following snippet can be added to a Jenkinsfile to install and analyze images:

 stage('Analyze image') {
steps {
// Install Docker Scout
sh 'curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /usr/local/bin'// Log into Docker Hub
sh 'echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin'// Analyze and fail on critical or high vulnerabilities
sh 'docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,high'
}
}

This example assume two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT.

Bitbucket

Use the following pipeline definition as a template to get Docker Scout integrated in Bitbucket Pipelines:

image: dockerpipelines:
default:
- step:
name: Buildservices:
- dockercaches:
- dockerscript:
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin $CI_REGISTRY# Install curl and the Docker Scout CLI
- | export DOCKER_BUILDKIT=0 apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin
- | export DEVELOPMENT_BRANCH="main" if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Bitbucket uses master by default, adjust if your default branch is different tag=":latest" echo "Running on default branch '$DEVELOPMENT_BRANCH': tag = 'latest'" else tag=":$BITBUCKET_COMMIT" echo "Running on branch '$BITBUCKET_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected  docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"definitions:
services:
docker:
memory: 2048# Optional: Increase if needed

This example assumes two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT, also is necessary more two secrets called CI_REGISTRY, CI_REGISTRY_IMAGE about registry info.

License

The Docker Scout CLI is licensed under the Terms and Conditions of the Docker Subscription Service Agreement.

About

Docker Scout CLI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

190 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Docker Scout

Docker Scout is a set of software supply chain features integrated into Docker's user interfaces and command line interface (CLI). These features offer comprehensive visibility into the structure and security of container images. This repository contains installable binaries of the docker scout CLI plugin.

Usage

The CLI documentation is available in this repository.

See the reference documentation to learn about Docker Scout including Docker Desktop and Docker Hub integrations.

Environment Variables

The following environment variables are available to configure the Scout CLI:

NameFormatDescription
DOCKER_SCOUT_CACHE_FORMATStringFormat of the local image cache; can be oci or tar
DOCKER_SCOUT_CACHE_DIRStringDirectory where the local SBOM cache is stored
DOCKER_SCOUT_NO_CACHEBooleanDisable the local SBOM cache
DOCKER_SCOUT_OFFLINEBooleanOffline mode during SBOM indexing
DOCKER_SCOUT_REGISTRY_TOKENStringRegistry Access token to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_USERStringRegistry user name to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_PASSWORDStringRegistry password/PAT to authenticate when pulling images
DOCKER_SCOUT_HUB_USERStringDocker Hub user name to authenticate against the Docker Scout backend
DOCKER_SCOUT_HUB_PASSWORDStringDocker Hub password/PAT to authenticate against the Docker Scout backend
DOCKER_SCOUT_NEW_VERSION_WARNBooleanWarn about new versions of the Docker Scout CLI
DOCKER_SCOUT_EXPERIMENTAL_WARNBooleanWarn about experimental features
DOCKER_SCOUT_EXPERIMENTAL_POLICY_OUTPUTBooleanDisable experimental policy output

You can found further information about environment variables here.

CLI Plugin Installation

Docker Desktop

docker scout CLI plugin is available by default on Docker Desktop starting with version 4.17.

Manual Installation

To install it manually:

  • Download the docker-scout binary corresponding to your platform from the latest or other releases.
  • Uncompress it as
    • docker-scout on Linux and macOS
    • docker-scout.exe on Windows
  • Copy the binary to the scout directory
    • $HOME/.docker/scout on Linux and macOS
    • %USERPROFILE%\.docker\scout on Windows
  • Make it executable on Linux and macOS
    • chmod +x $HOME/.docker/scout/docker-scout
  • Authorize the binary to be executable on macOS
    • xattr -d com.apple.quarantine $HOME/.docker/scout/docker-scout
  • Add the scout directory to your .docker/config.json as a plugin directory
    • $HOME/.docker/config.json on Linux and macOS
    • %USERPROFILE%\.docker\config.json on Windows
    • Add the cliPluginsExtraDirs property to the config.json file
{
...
"cliPluginsExtraDirs": [
"<full path to the .docker/scout folder>"
],
...
}

Script Installation (macOS and Linux)

To install, run the following command in your terminal:

curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --

Run as container

A container image to run the Docker Scout CLI in containerized environments is available at docker/scout-cli.

CI Integration

Docker Scout CLI can be used in CI environments. See below for the various ways to integrate the CLI into your CI pipelines.

GitHub Action

An early prototype of running the Docker Scout CLI as part of a GitHub Action workflow is available at docker/scout-action.

The following GitHub Action workflow can be used as a template to integrate Docker Scout:

name: Dockeron:
push:
tags: [ "*" ]branches:
- 'main'pull_request:
branches: [ "**" ]env:
# Use docker.io for Docker Hub if emptyREGISTRY: docker.ioIMAGE_NAME: ${{ github.repository }}SHA: ${{ github.event.pull_request.head.sha || github.event.after }}jobs:
build:
runs-on: ubuntu-latestpermissions:
contents: readpackages: writesteps:
- name: Checkout repositoryuses: actions/checkout@v3with:
ref: ${{ env.SHA }}
- name: Setup Docker buildxuses: docker/setup-buildx-action@v2.5.0# Login against a Docker registry except on PR# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}uses: docker/login-action@v2.1.0with:
registry: ${{ env.REGISTRY }}username: ${{ secrets.DOCKER_USER }}password: ${{ secrets.DOCKER_PAT }}# Extract metadata (tags, labels) for Docker# https://github.com/docker/metadata-action
- name: Extract Docker metadataid: metauses: docker/metadata-action@v4.4.0with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}labels: | org.opencontainers.image.revision=${{ env.SHA }}tags: | type=edge,branch=$repo.default_branch type=semver,pattern=v{{version}} type=sha,prefix=,suffix=,format=short# Build and push Docker image with Buildx (don't push on PR)# https://github.com/docker/build-push-action
- name: Build and push Docker imageid: build-and-pushuses: docker/build-push-action@v4.0.0with:
context: .push: truetags: ${{ steps.meta.outputs.tags }}labels: ${{ steps.meta.outputs.labels }}cache-from: type=ghacache-to: type=gha,mode=max
- name: Docker Scoutid: docker-scoutif: ${{ github.event_name == 'pull_request' }}uses: docker/scout-action@dd36f5b0295baffa006aa6623371f226cc03e506with:
command: cvesimage: ${{ steps.meta.outputs.tags }}only-severities: critical,highexit-code: true

GitLab

Use the following pipeline definition as a template to get Docker Scout integrated in GitLab CI:

docker-build:
image: docker:lateststage: buildservices:
- docker:dindbefore_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY# Install curl and the Docker Scout CLI
- | apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdinscript:
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then tag="" echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" else tag=":$CI_COMMIT_REF_SLUG" echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"rules:
- if: $CI_COMMIT_BRANCHexists:
- Dockerfile

CircleCI

Use the following pipeline definition as a template to get Docker Scout integrated in CircleCI project:

version: 2.1jobs:
build:
docker:
- image: cimg/base:stableenvironment:
IMAGE_TAG: docker/scout-demo-service:lateststeps:
# Checkout the repository files
- checkout# Set up a separate Docker environment to run `docker` commands in
- setup_remote_docker:
version: 20.10.24# Install Docker Scout and login to Docker Hub
- run:
name: Install Docker Scoutcommand: | env curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /home/circleci/bin echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin# Build the Docker image
- run:
name: Build Docker imagecommand: docker build -t $IMAGE_TAG .# Run Docker Scout 
- run:
name: Scan image for CVEscommand: | docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,highworkflows:
build-docker-image:
jobs:
- build

Microsoft Azure DevOps Pipelines

Use the following pipeline definition as a template to get Docker Scout integrated in Azure DevOps Pipelines:

trigger:
- mainresources:
- repo: selfvariables:
tag: '$(Build.BuildId)'image: 'vonwig/nodejs-service'stages:
- stage: BuilddisplayName: Build imagejobs:
- job: BuilddisplayName: Buildpool:
vmImage: ubuntu-lateststeps:
- task: Docker@2displayName: Build an imageinputs:
command: builddockerfile: '$(Build.SourcesDirectory)/Dockerfile'repository: $(image)tags: | $(tag) - task: CmdLine@2displayName: Find CVEs on imageinputs:
script: | # Install the Docker Scout CLI curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- # Login to Docker Hub required for Docker Scout CLI docker login -u $(DOCKER_HUB_USER) -p $(DOCKER_HUB_PAT) # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves $(image):$(tag) --exit-code --only-severity critical,high

Jenkins

The following snippet can be added to a Jenkinsfile to install and analyze images:

 stage('Analyze image') {
steps {
// Install Docker Scout
sh 'curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /usr/local/bin'// Log into Docker Hub
sh 'echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin'// Analyze and fail on critical or high vulnerabilities
sh 'docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,high'
}
}

This example assume two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT.

Bitbucket

Use the following pipeline definition as a template to get Docker Scout integrated in Bitbucket Pipelines:

image: dockerpipelines:
default:
- step:
name: Buildservices:
- dockercaches:
- dockerscript:
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin $CI_REGISTRY# Install curl and the Docker Scout CLI
- | export DOCKER_BUILDKIT=0 apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin
- | export DEVELOPMENT_BRANCH="main" if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Bitbucket uses master by default, adjust if your default branch is different tag=":latest" echo "Running on default branch '$DEVELOPMENT_BRANCH': tag = 'latest'" else tag=":$BITBUCKET_COMMIT" echo "Running on branch '$BITBUCKET_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected  docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"definitions:
services:
docker:
memory: 2048# Optional: Increase if needed

This example assumes two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT, also is necessary more two secrets called CI_REGISTRY, CI_REGISTRY_IMAGE about registry info.

License

The Docker Scout CLI is licensed under the Terms and Conditions of the Docker Subscription Service Agreement.

About

Docker Scout CLI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Latest commit

History

190 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Docker Scout

Docker Scout is a set of software supply chain features integrated into Docker's user interfaces and command line interface (CLI). These features offer comprehensive visibility into the structure and security of container images. This repository contains installable binaries of the docker scout CLI plugin.

Usage

The CLI documentation is available in this repository.

See the reference documentation to learn about Docker Scout including Docker Desktop and Docker Hub integrations.

Environment Variables

The following environment variables are available to configure the Scout CLI:

NameFormatDescription
DOCKER_SCOUT_CACHE_FORMATStringFormat of the local image cache; can be oci or tar
DOCKER_SCOUT_CACHE_DIRStringDirectory where the local SBOM cache is stored
DOCKER_SCOUT_NO_CACHEBooleanDisable the local SBOM cache
DOCKER_SCOUT_OFFLINEBooleanOffline mode during SBOM indexing
DOCKER_SCOUT_REGISTRY_TOKENStringRegistry Access token to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_USERStringRegistry user name to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_PASSWORDStringRegistry password/PAT to authenticate when pulling images
DOCKER_SCOUT_HUB_USERStringDocker Hub user name to authenticate against the Docker Scout backend
DOCKER_SCOUT_HUB_PASSWORDStringDocker Hub password/PAT to authenticate against the Docker Scout backend
DOCKER_SCOUT_NEW_VERSION_WARNBooleanWarn about new versions of the Docker Scout CLI
DOCKER_SCOUT_EXPERIMENTAL_WARNBooleanWarn about experimental features
DOCKER_SCOUT_EXPERIMENTAL_POLICY_OUTPUTBooleanDisable experimental policy output

You can found further information about environment variables here.

CLI Plugin Installation

Docker Desktop

docker scout CLI plugin is available by default on Docker Desktop starting with version 4.17.

Manual Installation

To install it manually:

  • Download the docker-scout binary corresponding to your platform from the latest or other releases.
  • Uncompress it as
    • docker-scout on Linux and macOS
    • docker-scout.exe on Windows
  • Copy the binary to the scout directory
    • $HOME/.docker/scout on Linux and macOS
    • %USERPROFILE%\.docker\scout on Windows
  • Make it executable on Linux and macOS
    • chmod +x $HOME/.docker/scout/docker-scout
  • Authorize the binary to be executable on macOS
    • xattr -d com.apple.quarantine $HOME/.docker/scout/docker-scout
  • Add the scout directory to your .docker/config.json as a plugin directory
    • $HOME/.docker/config.json on Linux and macOS
    • %USERPROFILE%\.docker\config.json on Windows
    • Add the cliPluginsExtraDirs property to the config.json file
{
...
"cliPluginsExtraDirs": [
"<full path to the .docker/scout folder>"
],
...
}

Script Installation (macOS and Linux)

To install, run the following command in your terminal:

curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --

Run as container

A container image to run the Docker Scout CLI in containerized environments is available at docker/scout-cli.

CI Integration

Docker Scout CLI can be used in CI environments. See below for the various ways to integrate the CLI into your CI pipelines.

GitHub Action

An early prototype of running the Docker Scout CLI as part of a GitHub Action workflow is available at docker/scout-action.

The following GitHub Action workflow can be used as a template to integrate Docker Scout:

name: Dockeron:
push:
tags: [ "*" ]branches:
- 'main'pull_request:
branches: [ "**" ]env:
# Use docker.io for Docker Hub if emptyREGISTRY: docker.ioIMAGE_NAME: ${{ github.repository }}SHA: ${{ github.event.pull_request.head.sha || github.event.after }}jobs:
build:
runs-on: ubuntu-latestpermissions:
contents: readpackages: writesteps:
- name: Checkout repositoryuses: actions/checkout@v3with:
ref: ${{ env.SHA }}
- name: Setup Docker buildxuses: docker/setup-buildx-action@v2.5.0# Login against a Docker registry except on PR# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}uses: docker/login-action@v2.1.0with:
registry: ${{ env.REGISTRY }}username: ${{ secrets.DOCKER_USER }}password: ${{ secrets.DOCKER_PAT }}# Extract metadata (tags, labels) for Docker# https://github.com/docker/metadata-action
- name: Extract Docker metadataid: metauses: docker/metadata-action@v4.4.0with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}labels: | org.opencontainers.image.revision=${{ env.SHA }}tags: | type=edge,branch=$repo.default_branch type=semver,pattern=v{{version}} type=sha,prefix=,suffix=,format=short# Build and push Docker image with Buildx (don't push on PR)# https://github.com/docker/build-push-action
- name: Build and push Docker imageid: build-and-pushuses: docker/build-push-action@v4.0.0with:
context: .push: truetags: ${{ steps.meta.outputs.tags }}labels: ${{ steps.meta.outputs.labels }}cache-from: type=ghacache-to: type=gha,mode=max
- name: Docker Scoutid: docker-scoutif: ${{ github.event_name == 'pull_request' }}uses: docker/scout-action@dd36f5b0295baffa006aa6623371f226cc03e506with:
command: cvesimage: ${{ steps.meta.outputs.tags }}only-severities: critical,highexit-code: true

GitLab

Use the following pipeline definition as a template to get Docker Scout integrated in GitLab CI:

docker-build:
image: docker:lateststage: buildservices:
- docker:dindbefore_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY# Install curl and the Docker Scout CLI
- | apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdinscript:
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then tag="" echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" else tag=":$CI_COMMIT_REF_SLUG" echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"rules:
- if: $CI_COMMIT_BRANCHexists:
- Dockerfile

CircleCI

Use the following pipeline definition as a template to get Docker Scout integrated in CircleCI project:

version: 2.1jobs:
build:
docker:
- image: cimg/base:stableenvironment:
IMAGE_TAG: docker/scout-demo-service:lateststeps:
# Checkout the repository files
- checkout# Set up a separate Docker environment to run `docker` commands in
- setup_remote_docker:
version: 20.10.24# Install Docker Scout and login to Docker Hub
- run:
name: Install Docker Scoutcommand: | env curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /home/circleci/bin echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin# Build the Docker image
- run:
name: Build Docker imagecommand: docker build -t $IMAGE_TAG .# Run Docker Scout 
- run:
name: Scan image for CVEscommand: | docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,highworkflows:
build-docker-image:
jobs:
- build

Microsoft Azure DevOps Pipelines

Use the following pipeline definition as a template to get Docker Scout integrated in Azure DevOps Pipelines:

trigger:
- mainresources:
- repo: selfvariables:
tag: '$(Build.BuildId)'image: 'vonwig/nodejs-service'stages:
- stage: BuilddisplayName: Build imagejobs:
- job: BuilddisplayName: Buildpool:
vmImage: ubuntu-lateststeps:
- task: Docker@2displayName: Build an imageinputs:
command: builddockerfile: '$(Build.SourcesDirectory)/Dockerfile'repository: $(image)tags: | $(tag) - task: CmdLine@2displayName: Find CVEs on imageinputs:
script: | # Install the Docker Scout CLI curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- # Login to Docker Hub required for Docker Scout CLI docker login -u $(DOCKER_HUB_USER) -p $(DOCKER_HUB_PAT) # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves $(image):$(tag) --exit-code --only-severity critical,high

Jenkins

The following snippet can be added to a Jenkinsfile to install and analyze images:

 stage('Analyze image') {
steps {
// Install Docker Scout
sh 'curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /usr/local/bin'// Log into Docker Hub
sh 'echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin'// Analyze and fail on critical or high vulnerabilities
sh 'docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,high'
}
}

This example assume two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT.

Bitbucket

Use the following pipeline definition as a template to get Docker Scout integrated in Bitbucket Pipelines:

image: dockerpipelines:
default:
- step:
name: Buildservices:
- dockercaches:
- dockerscript:
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin $CI_REGISTRY# Install curl and the Docker Scout CLI
- | export DOCKER_BUILDKIT=0 apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin
- | export DEVELOPMENT_BRANCH="main" if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Bitbucket uses master by default, adjust if your default branch is different tag=":latest" echo "Running on default branch '$DEVELOPMENT_BRANCH': tag = 'latest'" else tag=":$BITBUCKET_COMMIT" echo "Running on branch '$BITBUCKET_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected  docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"definitions:
services:
docker:
memory: 2048# Optional: Increase if needed

This example assumes two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT, also is necessary more two secrets called CI_REGISTRY, CI_REGISTRY_IMAGE about registry info.

License

The Docker Scout CLI is licensed under the Terms and Conditions of the Docker Subscription Service Agreement.

About

Docker Scout CLI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

190 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Docker Scout

Docker Scout is a set of software supply chain features integrated into Docker's user interfaces and command line interface (CLI). These features offer comprehensive visibility into the structure and security of container images. This repository contains installable binaries of the docker scout CLI plugin.

Usage

The CLI documentation is available in this repository.

See the reference documentation to learn about Docker Scout including Docker Desktop and Docker Hub integrations.

Environment Variables

The following environment variables are available to configure the Scout CLI:

NameFormatDescription
DOCKER_SCOUT_CACHE_FORMATStringFormat of the local image cache; can be oci or tar
DOCKER_SCOUT_CACHE_DIRStringDirectory where the local SBOM cache is stored
DOCKER_SCOUT_NO_CACHEBooleanDisable the local SBOM cache
DOCKER_SCOUT_OFFLINEBooleanOffline mode during SBOM indexing
DOCKER_SCOUT_REGISTRY_TOKENStringRegistry Access token to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_USERStringRegistry user name to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_PASSWORDStringRegistry password/PAT to authenticate when pulling images
DOCKER_SCOUT_HUB_USERStringDocker Hub user name to authenticate against the Docker Scout backend
DOCKER_SCOUT_HUB_PASSWORDStringDocker Hub password/PAT to authenticate against the Docker Scout backend
DOCKER_SCOUT_NEW_VERSION_WARNBooleanWarn about new versions of the Docker Scout CLI
DOCKER_SCOUT_EXPERIMENTAL_WARNBooleanWarn about experimental features
DOCKER_SCOUT_EXPERIMENTAL_POLICY_OUTPUTBooleanDisable experimental policy output

You can found further information about environment variables here.

CLI Plugin Installation

Docker Desktop

docker scout CLI plugin is available by default on Docker Desktop starting with version 4.17.

Manual Installation

To install it manually:

  • Download the docker-scout binary corresponding to your platform from the latest or other releases.
  • Uncompress it as
    • docker-scout on Linux and macOS
    • docker-scout.exe on Windows
  • Copy the binary to the scout directory
    • $HOME/.docker/scout on Linux and macOS
    • %USERPROFILE%\.docker\scout on Windows
  • Make it executable on Linux and macOS
    • chmod +x $HOME/.docker/scout/docker-scout
  • Authorize the binary to be executable on macOS
    • xattr -d com.apple.quarantine $HOME/.docker/scout/docker-scout
  • Add the scout directory to your .docker/config.json as a plugin directory
    • $HOME/.docker/config.json on Linux and macOS
    • %USERPROFILE%\.docker\config.json on Windows
    • Add the cliPluginsExtraDirs property to the config.json file
{
...
"cliPluginsExtraDirs": [
"<full path to the .docker/scout folder>"
],
...
}

Script Installation (macOS and Linux)

To install, run the following command in your terminal:

curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --

Run as container

A container image to run the Docker Scout CLI in containerized environments is available at docker/scout-cli.

CI Integration

Docker Scout CLI can be used in CI environments. See below for the various ways to integrate the CLI into your CI pipelines.

GitHub Action

An early prototype of running the Docker Scout CLI as part of a GitHub Action workflow is available at docker/scout-action.

The following GitHub Action workflow can be used as a template to integrate Docker Scout:

name: Dockeron:
push:
tags: [ "*" ]branches:
- 'main'pull_request:
branches: [ "**" ]env:
# Use docker.io for Docker Hub if emptyREGISTRY: docker.ioIMAGE_NAME: ${{ github.repository }}SHA: ${{ github.event.pull_request.head.sha || github.event.after }}jobs:
build:
runs-on: ubuntu-latestpermissions:
contents: readpackages: writesteps:
- name: Checkout repositoryuses: actions/checkout@v3with:
ref: ${{ env.SHA }}
- name: Setup Docker buildxuses: docker/setup-buildx-action@v2.5.0# Login against a Docker registry except on PR# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}uses: docker/login-action@v2.1.0with:
registry: ${{ env.REGISTRY }}username: ${{ secrets.DOCKER_USER }}password: ${{ secrets.DOCKER_PAT }}# Extract metadata (tags, labels) for Docker# https://github.com/docker/metadata-action
- name: Extract Docker metadataid: metauses: docker/metadata-action@v4.4.0with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}labels: | org.opencontainers.image.revision=${{ env.SHA }}tags: | type=edge,branch=$repo.default_branch type=semver,pattern=v{{version}} type=sha,prefix=,suffix=,format=short# Build and push Docker image with Buildx (don't push on PR)# https://github.com/docker/build-push-action
- name: Build and push Docker imageid: build-and-pushuses: docker/build-push-action@v4.0.0with:
context: .push: truetags: ${{ steps.meta.outputs.tags }}labels: ${{ steps.meta.outputs.labels }}cache-from: type=ghacache-to: type=gha,mode=max
- name: Docker Scoutid: docker-scoutif: ${{ github.event_name == 'pull_request' }}uses: docker/scout-action@dd36f5b0295baffa006aa6623371f226cc03e506with:
command: cvesimage: ${{ steps.meta.outputs.tags }}only-severities: critical,highexit-code: true

GitLab

Use the following pipeline definition as a template to get Docker Scout integrated in GitLab CI:

docker-build:
image: docker:lateststage: buildservices:
- docker:dindbefore_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY# Install curl and the Docker Scout CLI
- | apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdinscript:
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then tag="" echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" else tag=":$CI_COMMIT_REF_SLUG" echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"rules:
- if: $CI_COMMIT_BRANCHexists:
- Dockerfile

CircleCI

Use the following pipeline definition as a template to get Docker Scout integrated in CircleCI project:

version: 2.1jobs:
build:
docker:
- image: cimg/base:stableenvironment:
IMAGE_TAG: docker/scout-demo-service:lateststeps:
# Checkout the repository files
- checkout# Set up a separate Docker environment to run `docker` commands in
- setup_remote_docker:
version: 20.10.24# Install Docker Scout and login to Docker Hub
- run:
name: Install Docker Scoutcommand: | env curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /home/circleci/bin echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin# Build the Docker image
- run:
name: Build Docker imagecommand: docker build -t $IMAGE_TAG .# Run Docker Scout 
- run:
name: Scan image for CVEscommand: | docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,highworkflows:
build-docker-image:
jobs:
- build

Microsoft Azure DevOps Pipelines

Use the following pipeline definition as a template to get Docker Scout integrated in Azure DevOps Pipelines:

trigger:
- mainresources:
- repo: selfvariables:
tag: '$(Build.BuildId)'image: 'vonwig/nodejs-service'stages:
- stage: BuilddisplayName: Build imagejobs:
- job: BuilddisplayName: Buildpool:
vmImage: ubuntu-lateststeps:
- task: Docker@2displayName: Build an imageinputs:
command: builddockerfile: '$(Build.SourcesDirectory)/Dockerfile'repository: $(image)tags: | $(tag) - task: CmdLine@2displayName: Find CVEs on imageinputs:
script: | # Install the Docker Scout CLI curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- # Login to Docker Hub required for Docker Scout CLI docker login -u $(DOCKER_HUB_USER) -p $(DOCKER_HUB_PAT) # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves $(image):$(tag) --exit-code --only-severity critical,high

Jenkins

The following snippet can be added to a Jenkinsfile to install and analyze images:

 stage('Analyze image') {
steps {
// Install Docker Scout
sh 'curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /usr/local/bin'// Log into Docker Hub
sh 'echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin'// Analyze and fail on critical or high vulnerabilities
sh 'docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,high'
}
}

This example assume two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT.

Bitbucket

Use the following pipeline definition as a template to get Docker Scout integrated in Bitbucket Pipelines:

image: dockerpipelines:
default:
- step:
name: Buildservices:
- dockercaches:
- dockerscript:
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin $CI_REGISTRY# Install curl and the Docker Scout CLI
- | export DOCKER_BUILDKIT=0 apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin
- | export DEVELOPMENT_BRANCH="main" if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Bitbucket uses master by default, adjust if your default branch is different tag=":latest" echo "Running on default branch '$DEVELOPMENT_BRANCH': tag = 'latest'" else tag=":$BITBUCKET_COMMIT" echo "Running on branch '$BITBUCKET_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected  docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"definitions:
services:
docker:
memory: 2048# Optional: Increase if needed

This example assumes two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT, also is necessary more two secrets called CI_REGISTRY, CI_REGISTRY_IMAGE about registry info.

License

The Docker Scout CLI is licensed under the Terms and Conditions of the Docker Subscription Service Agreement.

About

Docker Scout CLI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

190 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Docker Scout

Docker Scout is a set of software supply chain features integrated into Docker's user interfaces and command line interface (CLI). These features offer comprehensive visibility into the structure and security of container images. This repository contains installable binaries of the docker scout CLI plugin.

Usage

The CLI documentation is available in this repository.

See the reference documentation to learn about Docker Scout including Docker Desktop and Docker Hub integrations.

Environment Variables

The following environment variables are available to configure the Scout CLI:

NameFormatDescription
DOCKER_SCOUT_CACHE_FORMATStringFormat of the local image cache; can be oci or tar
DOCKER_SCOUT_CACHE_DIRStringDirectory where the local SBOM cache is stored
DOCKER_SCOUT_NO_CACHEBooleanDisable the local SBOM cache
DOCKER_SCOUT_OFFLINEBooleanOffline mode during SBOM indexing
DOCKER_SCOUT_REGISTRY_TOKENStringRegistry Access token to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_USERStringRegistry user name to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_PASSWORDStringRegistry password/PAT to authenticate when pulling images
DOCKER_SCOUT_HUB_USERStringDocker Hub user name to authenticate against the Docker Scout backend
DOCKER_SCOUT_HUB_PASSWORDStringDocker Hub password/PAT to authenticate against the Docker Scout backend
DOCKER_SCOUT_NEW_VERSION_WARNBooleanWarn about new versions of the Docker Scout CLI
DOCKER_SCOUT_EXPERIMENTAL_WARNBooleanWarn about experimental features
DOCKER_SCOUT_EXPERIMENTAL_POLICY_OUTPUTBooleanDisable experimental policy output

You can found further information about environment variables here.

CLI Plugin Installation

Docker Desktop

docker scout CLI plugin is available by default on Docker Desktop starting with version 4.17.

Manual Installation

To install it manually:

  • Download the docker-scout binary corresponding to your platform from the latest or other releases.
  • Uncompress it as
    • docker-scout on Linux and macOS
    • docker-scout.exe on Windows
  • Copy the binary to the scout directory
    • $HOME/.docker/scout on Linux and macOS
    • %USERPROFILE%\.docker\scout on Windows
  • Make it executable on Linux and macOS
    • chmod +x $HOME/.docker/scout/docker-scout
  • Authorize the binary to be executable on macOS
    • xattr -d com.apple.quarantine $HOME/.docker/scout/docker-scout
  • Add the scout directory to your .docker/config.json as a plugin directory
    • $HOME/.docker/config.json on Linux and macOS
    • %USERPROFILE%\.docker\config.json on Windows
    • Add the cliPluginsExtraDirs property to the config.json file
{
...
"cliPluginsExtraDirs": [
"<full path to the .docker/scout folder>"
],
...
}

Script Installation (macOS and Linux)

To install, run the following command in your terminal:

curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --

Run as container

A container image to run the Docker Scout CLI in containerized environments is available at docker/scout-cli.

CI Integration

Docker Scout CLI can be used in CI environments. See below for the various ways to integrate the CLI into your CI pipelines.

GitHub Action

An early prototype of running the Docker Scout CLI as part of a GitHub Action workflow is available at docker/scout-action.

The following GitHub Action workflow can be used as a template to integrate Docker Scout:

name: Dockeron:
push:
tags: [ "*" ]branches:
- 'main'pull_request:
branches: [ "**" ]env:
# Use docker.io for Docker Hub if emptyREGISTRY: docker.ioIMAGE_NAME: ${{ github.repository }}SHA: ${{ github.event.pull_request.head.sha || github.event.after }}jobs:
build:
runs-on: ubuntu-latestpermissions:
contents: readpackages: writesteps:
- name: Checkout repositoryuses: actions/checkout@v3with:
ref: ${{ env.SHA }}
- name: Setup Docker buildxuses: docker/setup-buildx-action@v2.5.0# Login against a Docker registry except on PR# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}uses: docker/login-action@v2.1.0with:
registry: ${{ env.REGISTRY }}username: ${{ secrets.DOCKER_USER }}password: ${{ secrets.DOCKER_PAT }}# Extract metadata (tags, labels) for Docker# https://github.com/docker/metadata-action
- name: Extract Docker metadataid: metauses: docker/metadata-action@v4.4.0with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}labels: | org.opencontainers.image.revision=${{ env.SHA }}tags: | type=edge,branch=$repo.default_branch type=semver,pattern=v{{version}} type=sha,prefix=,suffix=,format=short# Build and push Docker image with Buildx (don't push on PR)# https://github.com/docker/build-push-action
- name: Build and push Docker imageid: build-and-pushuses: docker/build-push-action@v4.0.0with:
context: .push: truetags: ${{ steps.meta.outputs.tags }}labels: ${{ steps.meta.outputs.labels }}cache-from: type=ghacache-to: type=gha,mode=max
- name: Docker Scoutid: docker-scoutif: ${{ github.event_name == 'pull_request' }}uses: docker/scout-action@dd36f5b0295baffa006aa6623371f226cc03e506with:
command: cvesimage: ${{ steps.meta.outputs.tags }}only-severities: critical,highexit-code: true

GitLab

Use the following pipeline definition as a template to get Docker Scout integrated in GitLab CI:

docker-build:
image: docker:lateststage: buildservices:
- docker:dindbefore_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY# Install curl and the Docker Scout CLI
- | apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdinscript:
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then tag="" echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" else tag=":$CI_COMMIT_REF_SLUG" echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"rules:
- if: $CI_COMMIT_BRANCHexists:
- Dockerfile

CircleCI

Use the following pipeline definition as a template to get Docker Scout integrated in CircleCI project:

version: 2.1jobs:
build:
docker:
- image: cimg/base:stableenvironment:
IMAGE_TAG: docker/scout-demo-service:lateststeps:
# Checkout the repository files
- checkout# Set up a separate Docker environment to run `docker` commands in
- setup_remote_docker:
version: 20.10.24# Install Docker Scout and login to Docker Hub
- run:
name: Install Docker Scoutcommand: | env curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /home/circleci/bin echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin# Build the Docker image
- run:
name: Build Docker imagecommand: docker build -t $IMAGE_TAG .# Run Docker Scout 
- run:
name: Scan image for CVEscommand: | docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,highworkflows:
build-docker-image:
jobs:
- build

Microsoft Azure DevOps Pipelines

Use the following pipeline definition as a template to get Docker Scout integrated in Azure DevOps Pipelines:

trigger:
- mainresources:
- repo: selfvariables:
tag: '$(Build.BuildId)'image: 'vonwig/nodejs-service'stages:
- stage: BuilddisplayName: Build imagejobs:
- job: BuilddisplayName: Buildpool:
vmImage: ubuntu-lateststeps:
- task: Docker@2displayName: Build an imageinputs:
command: builddockerfile: '$(Build.SourcesDirectory)/Dockerfile'repository: $(image)tags: | $(tag) - task: CmdLine@2displayName: Find CVEs on imageinputs:
script: | # Install the Docker Scout CLI curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- # Login to Docker Hub required for Docker Scout CLI docker login -u $(DOCKER_HUB_USER) -p $(DOCKER_HUB_PAT) # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves $(image):$(tag) --exit-code --only-severity critical,high

Jenkins

The following snippet can be added to a Jenkinsfile to install and analyze images:

 stage('Analyze image') {
steps {
// Install Docker Scout
sh 'curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /usr/local/bin'// Log into Docker Hub
sh 'echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin'// Analyze and fail on critical or high vulnerabilities
sh 'docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,high'
}
}

This example assume two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT.

Bitbucket

Use the following pipeline definition as a template to get Docker Scout integrated in Bitbucket Pipelines:

image: dockerpipelines:
default:
- step:
name: Buildservices:
- dockercaches:
- dockerscript:
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin $CI_REGISTRY# Install curl and the Docker Scout CLI
- | export DOCKER_BUILDKIT=0 apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin
- | export DEVELOPMENT_BRANCH="main" if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Bitbucket uses master by default, adjust if your default branch is different tag=":latest" echo "Running on default branch '$DEVELOPMENT_BRANCH': tag = 'latest'" else tag=":$BITBUCKET_COMMIT" echo "Running on branch '$BITBUCKET_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected  docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"definitions:
services:
docker:
memory: 2048# Optional: Increase if needed

This example assumes two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT, also is necessary more two secrets called CI_REGISTRY, CI_REGISTRY_IMAGE about registry info.

License

The Docker Scout CLI is licensed under the Terms and Conditions of the Docker Subscription Service Agreement.

About

Docker Scout CLI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Latest commit

History

190 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Docker Scout

Docker Scout is a set of software supply chain features integrated into Docker's user interfaces and command line interface (CLI). These features offer comprehensive visibility into the structure and security of container images. This repository contains installable binaries of the docker scout CLI plugin.

Usage

The CLI documentation is available in this repository.

See the reference documentation to learn about Docker Scout including Docker Desktop and Docker Hub integrations.

Environment Variables

The following environment variables are available to configure the Scout CLI:

NameFormatDescription
DOCKER_SCOUT_CACHE_FORMATStringFormat of the local image cache; can be oci or tar
DOCKER_SCOUT_CACHE_DIRStringDirectory where the local SBOM cache is stored
DOCKER_SCOUT_NO_CACHEBooleanDisable the local SBOM cache
DOCKER_SCOUT_OFFLINEBooleanOffline mode during SBOM indexing
DOCKER_SCOUT_REGISTRY_TOKENStringRegistry Access token to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_USERStringRegistry user name to authenticate when pulling images
DOCKER_SCOUT_REGISTRY_PASSWORDStringRegistry password/PAT to authenticate when pulling images
DOCKER_SCOUT_HUB_USERStringDocker Hub user name to authenticate against the Docker Scout backend
DOCKER_SCOUT_HUB_PASSWORDStringDocker Hub password/PAT to authenticate against the Docker Scout backend
DOCKER_SCOUT_NEW_VERSION_WARNBooleanWarn about new versions of the Docker Scout CLI
DOCKER_SCOUT_EXPERIMENTAL_WARNBooleanWarn about experimental features
DOCKER_SCOUT_EXPERIMENTAL_POLICY_OUTPUTBooleanDisable experimental policy output

You can found further information about environment variables here.

CLI Plugin Installation

Docker Desktop

docker scout CLI plugin is available by default on Docker Desktop starting with version 4.17.

Manual Installation

To install it manually:

  • Download the docker-scout binary corresponding to your platform from the latest or other releases.
  • Uncompress it as
    • docker-scout on Linux and macOS
    • docker-scout.exe on Windows
  • Copy the binary to the scout directory
    • $HOME/.docker/scout on Linux and macOS
    • %USERPROFILE%\.docker\scout on Windows
  • Make it executable on Linux and macOS
    • chmod +x $HOME/.docker/scout/docker-scout
  • Authorize the binary to be executable on macOS
    • xattr -d com.apple.quarantine $HOME/.docker/scout/docker-scout
  • Add the scout directory to your .docker/config.json as a plugin directory
    • $HOME/.docker/config.json on Linux and macOS
    • %USERPROFILE%\.docker\config.json on Windows
    • Add the cliPluginsExtraDirs property to the config.json file
{
...
"cliPluginsExtraDirs": [
"<full path to the .docker/scout folder>"
],
...
}

Script Installation (macOS and Linux)

To install, run the following command in your terminal:

curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --

Run as container

A container image to run the Docker Scout CLI in containerized environments is available at docker/scout-cli.

CI Integration

Docker Scout CLI can be used in CI environments. See below for the various ways to integrate the CLI into your CI pipelines.

GitHub Action

An early prototype of running the Docker Scout CLI as part of a GitHub Action workflow is available at docker/scout-action.

The following GitHub Action workflow can be used as a template to integrate Docker Scout:

name: Dockeron:
push:
tags: [ "*" ]branches:
- 'main'pull_request:
branches: [ "**" ]env:
# Use docker.io for Docker Hub if emptyREGISTRY: docker.ioIMAGE_NAME: ${{ github.repository }}SHA: ${{ github.event.pull_request.head.sha || github.event.after }}jobs:
build:
runs-on: ubuntu-latestpermissions:
contents: readpackages: writesteps:
- name: Checkout repositoryuses: actions/checkout@v3with:
ref: ${{ env.SHA }}
- name: Setup Docker buildxuses: docker/setup-buildx-action@v2.5.0# Login against a Docker registry except on PR# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}uses: docker/login-action@v2.1.0with:
registry: ${{ env.REGISTRY }}username: ${{ secrets.DOCKER_USER }}password: ${{ secrets.DOCKER_PAT }}# Extract metadata (tags, labels) for Docker# https://github.com/docker/metadata-action
- name: Extract Docker metadataid: metauses: docker/metadata-action@v4.4.0with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}labels: | org.opencontainers.image.revision=${{ env.SHA }}tags: | type=edge,branch=$repo.default_branch type=semver,pattern=v{{version}} type=sha,prefix=,suffix=,format=short# Build and push Docker image with Buildx (don't push on PR)# https://github.com/docker/build-push-action
- name: Build and push Docker imageid: build-and-pushuses: docker/build-push-action@v4.0.0with:
context: .push: truetags: ${{ steps.meta.outputs.tags }}labels: ${{ steps.meta.outputs.labels }}cache-from: type=ghacache-to: type=gha,mode=max
- name: Docker Scoutid: docker-scoutif: ${{ github.event_name == 'pull_request' }}uses: docker/scout-action@dd36f5b0295baffa006aa6623371f226cc03e506with:
command: cvesimage: ${{ steps.meta.outputs.tags }}only-severities: critical,highexit-code: true

GitLab

Use the following pipeline definition as a template to get Docker Scout integrated in GitLab CI:

docker-build:
image: docker:lateststage: buildservices:
- docker:dindbefore_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY# Install curl and the Docker Scout CLI
- | apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdinscript:
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then tag="" echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" else tag=":$CI_COMMIT_REF_SLUG" echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"rules:
- if: $CI_COMMIT_BRANCHexists:
- Dockerfile

CircleCI

Use the following pipeline definition as a template to get Docker Scout integrated in CircleCI project:

version: 2.1jobs:
build:
docker:
- image: cimg/base:stableenvironment:
IMAGE_TAG: docker/scout-demo-service:lateststeps:
# Checkout the repository files
- checkout# Set up a separate Docker environment to run `docker` commands in
- setup_remote_docker:
version: 20.10.24# Install Docker Scout and login to Docker Hub
- run:
name: Install Docker Scoutcommand: | env curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /home/circleci/bin echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin# Build the Docker image
- run:
name: Build Docker imagecommand: docker build -t $IMAGE_TAG .# Run Docker Scout 
- run:
name: Scan image for CVEscommand: | docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,highworkflows:
build-docker-image:
jobs:
- build

Microsoft Azure DevOps Pipelines

Use the following pipeline definition as a template to get Docker Scout integrated in Azure DevOps Pipelines:

trigger:
- mainresources:
- repo: selfvariables:
tag: '$(Build.BuildId)'image: 'vonwig/nodejs-service'stages:
- stage: BuilddisplayName: Build imagejobs:
- job: BuilddisplayName: Buildpool:
vmImage: ubuntu-lateststeps:
- task: Docker@2displayName: Build an imageinputs:
command: builddockerfile: '$(Build.SourcesDirectory)/Dockerfile'repository: $(image)tags: | $(tag) - task: CmdLine@2displayName: Find CVEs on imageinputs:
script: | # Install the Docker Scout CLI curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- # Login to Docker Hub required for Docker Scout CLI docker login -u $(DOCKER_HUB_USER) -p $(DOCKER_HUB_PAT) # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves $(image):$(tag) --exit-code --only-severity critical,high

Jenkins

The following snippet can be added to a Jenkinsfile to install and analyze images:

 stage('Analyze image') {
steps {
// Install Docker Scout
sh 'curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s -- -b /usr/local/bin'// Log into Docker Hub
sh 'echo $DOCKER_HUB_PAT | docker login -u $DOCKER_HUB_USER --password-stdin'// Analyze and fail on critical or high vulnerabilities
sh 'docker-scout cves $IMAGE_TAG --exit-code --only-severity critical,high'
}
}

This example assume two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT.

Bitbucket

Use the following pipeline definition as a template to get Docker Scout integrated in Bitbucket Pipelines:

image: dockerpipelines:
default:
- step:
name: Buildservices:
- dockercaches:
- dockerscript:
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin $CI_REGISTRY# Install curl and the Docker Scout CLI
- | export DOCKER_BUILDKIT=0 apk add --update curl curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --  apk del curl  rm -rf /var/cache/apk/* # Login to Docker Hub required for Docker Scout CLI
- echo "$DOCKER_HUB_PAT" | docker login --username "$DOCKER_HUB_USER" --password-stdin
- | export DEVELOPMENT_BRANCH="main" if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Bitbucket uses master by default, adjust if your default branch is different tag=":latest" echo "Running on default branch '$DEVELOPMENT_BRANCH': tag = 'latest'" else tag=":$BITBUCKET_COMMIT" echo "Running on branch '$BITBUCKET_BRANCH': tag = $tag" fi - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- | if [[ "$BITBUCKET_BRANCH" == "$DEVELOPMENT_BRANCH" ]]; then # Get a CVE report for the built image and fail the pipeline when critical or high CVEs are detected docker scout cves "$CI_REGISTRY_IMAGE${tag}" --exit-code --only-severity critical,high  else # Compare image from branch with latest image from the default branch and fail if new critical or high CVEs are detected  docker scout compare "$CI_REGISTRY_IMAGE${tag}" --to "$CI_REGISTRY_IMAGE:latest" --exit-on vulnerability,policy --only-severity critical,high --ignore-unchanged fi - docker push "$CI_REGISTRY_IMAGE${tag}"definitions:
services:
docker:
memory: 2048# Optional: Increase if needed

This example assumes two secrets to be available to authenticate against Docker Hub, called DOCKER_HUB_USER and DOCKER_HUB_PAT, also is necessary more two secrets called CI_REGISTRY, CI_REGISTRY_IMAGE about registry info.

License

The Docker Scout CLI is licensed under the Terms and Conditions of the Docker Subscription Service Agreement.

About

Docker Scout CLI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages