Docker image
  • Updated on 30 May 2019
  • 1 minute to read
  • Contributors
  • Share
  • Dark
    Light

Docker image

  • Share
  • Dark
    Light

Go to Datree's "custom rules" tab and click on "create new rule" button

3x-7d2fdb6-1.png

1. Choose custom rule type

Step 1 at the wizard - choose "custom Docker image"

Screen Shot 2019-05-12 at 18.32.02

2. Edit custom rule details

The rule description will be shown on the custom rule dashboard, while the rule title will be used on GitHub "smart policy" check

Screen Shot 2019-05-12 at 18.35.42

3. Configure your custom rule

  • Regular Expression - which pattern should be validated for the Docker image property

Screen Shot 2019-05-12 at 18.40.34

🏴 Black-listing images with regular expression:

RegEx: ^((?!<YOUR_STRING_HERE>).)*$

For example, setting the regular expression ^((?!python:2\.7\.\d+).)*$ will make sure you DON'T use python 2.7.x images.

🏳 White-listing images with regular expression:

RegEx: <YOUR_STRING_HERE>

For example, setting the regular expression python:3\.\d+\.\d+ will make sure you ONLY use python 3.x.x images.

4. Wrap it up

Click on the "create" button to add your custom policy to the policies menu on the left.

Screen Shot 2019-05-12 at 19.13.42

By default, the rule will not be enabled until explicitly defining repositories

5. See your custom policy in action!

Docker image which will NOT pass the policy:

Screen Shot 2019-05-12 at 13.58.08

After updating the Docker image property:

Screen Shot 2019-05-30 at 14.17.17

Was this article helpful?