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
- Add projects and images to the Snyk UI
- Add your Dockerfile for base image remediation
Configure integration for Docker Hub
Enable integration between Docker Hub and Snyk, and start managing your vulnerabilities.
- From the Snyk UI, log in to your account and navigate to Integrations from the menu bar at the top.
- From the Integrations page under the Docker Hub logo, click the Connect to Docker Hub button:
- 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.
- 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.
- 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.
- Go to Projects and click Add projects.
- From the page that loads, click the Docker Hub option:
- The Add Projects view appears, displaying all users, organizations and images from your Docker Hub account, similar to the following:
- Checkmark the relevant images for import and monitoring.
- 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 and scratch 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.
- 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.
- To include your Dockerfile, ensure the GitHub account that you integrate Snyk with contains the relevant Dockerfile repo.
- 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:
- From the Project settings page, click Update Dockerfile:
- 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.
- The Add Projects view appears, displaying all repositories from the GitHub account with which you integrated, grouped per organization and personal account:
- Checkmark the relevant repo from which to import the Dockerfile.
- Enter the relative path in the Path to your Dockerfile field in the following format:
- 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.