Snyk Documentation

Docker Hub—integrate and test

Snyk integrates with Docker Hub to enable you to import snapshots of your projects to our UI and then test and monitor image layers directly from your registries.

This section describes:

Configure integration for Docker Hub

Enable integration between Docker Hub and Snyk, and start managing your vulnerabilities.

    1. From the Snyk UI, log in to your account and navigate to Integrations from the menu bar at the top.
    2. From the Integrations page under the Docker Hub logo, click the Connect to Docker Hub button:
    3. From the Settings page in the Integrations area, enter your Docker Hub username and password and then click Save:
      Snyk tests the connection values and the page reloads, now displaying Docker Hub integration information and the Add your Docker Hub images to Snyk button.
      A confirmation message that the details were saved also appears in green at the top of the screen. In addition, if the connection to Docker Hub failed, a notification appears.
    4. Now, add images for testing and monitoring. Click Add your Docker Hub images to Snyk.
      The Add Projects view appears, displaying all repos from your Docker Hub account. Go to Add projects and images to the Snyk UI to continue.
    5. Additionally, you can now connect your Git repo to this project in order to use your Dockerfile for enriched remediation advice. For more info, see Add your Dockerfile for base image remediation.

Add projects and images to the Snyk UI

Snyk tests and monitors Docker Hub repositories and images by evaluating root folders.

To add repositories to Snyk:

Note: If you already clicked Add your Docker Hub images button from the Settings page, you can start with step 3.

        1. Go to Projects and click Add projects.
        2. From the page that loads, click the Docker Hub option:
        3. The Add Projects view appears, displaying all users, organizations and images from your Docker Hub account, similar to the following:
        4. Checkmark the relevant images for import and monitoring.
        5. Click Add selected images to Snyk.
          Snyk tests the images and also imports them to the UI.
          Once repositories and images are imported, a confirmation appears in green at the top of the screen. Docker Hub files are indicated with a unique icon .

          You can now also filter to view only those projects:

      Add your Dockerfile for base image remediation

      To receive base image remediation advice, including major, minor and alternative upgrades as well as advice when you need to rebuild your image, integrate with GitHub and import the GitHub repo that contains the relevant Dockerfile.

      1. Ensure you have already imported the relevant Docker Hub project for monitoring. See Configure integration for Docker Hub for scanning and monitoring for more info.
      2. To include your Dockerfile, ensure the GitHub account that you integrate Snyk with contains the relevant Dockerfile repo.
      3. From the Project tab, click the settings cog to access the settings for the specific project to which you would like to add a Dockerfile:
      4. From the Project settings page, click Update Dockerfile:
      5. If you haven’t already configured a GitHub integration, Snyk redirects you to the Integrations page. Click Connect to GitHub and enable access to private and public repos.
      6. The Add Projects view appears, displaying all repositories from the GitHub account with which you integrated, grouped per organization and personal account:
      7. Checkmark the relevant repo from which to import the Dockerfile.
      8. Enter the relative path in the Path to your Dockerfile field in the following format: /path/dockerfile.
      9. Click Save.
        Snyk tests the project again, this time producing any relevant base image remediation advice such as in the following example:

      Docker Hub integration works similar to our other integrations. To continue to monitor, remediate and manage your projects, see the relevant pages in our docs.