Skip to main content

Dockter: the doctor for your Dockerfiles

The objective of Dockter is to make your Dockerfiles better, it will make sure that your Dockerfiles:

  • build secure images
  • build smaller images
  • build faster
  • follow best practices
  • are pretty formatted

DevOps lifecycle

Typically, a CI/CD pipeline consists of roughly the following steps:

  • lint code
  • build Docker image
  • run tests in Docker image
  • scan image for vulnerabilities (hopefully)
  • push image to registry
  • deploy image

Dockter fits into the first stage and aims to prevent building an image that exposes credentials or contains vulnerabilities, which at the bare minimum saves CI/CD minutes.

Separate processes like container registry scanning will also run, but they may run only after an image has been pushed, potentially already exposing a vulnerable image to the public.

What makes Dockter special?

Good question, Dockter is the byproduct of a much bigger product, GitLab AI Assist, as a first starting point, Dockerfiles were chosen. A parser was developed to fully parse Dockerfiles in a format that is designed for machine learning. In order to train ML models, there is a need to create a large, rich dataset and in order to do that a good analysis of Dockerfiles is needed. Hence, the creation of Dockter. It will start improving your Dockerfiles from day 1 but will become much more powerful in the future, eventually it will automatically create Dockerfiles for you.

No telemetry

No worries, your Dockerfiles remain private, Dockter won't share any telemetry with GitLab, perhaps at some point in time when machine learning models would benefit from user feedback, the option to provide anonymous feedback may be, with plenty of user awareness and opt-in, introduced.

Dynamic parser

The parser behind Dockter has been designed with data and ML in mind, it supports parsing of all Docker instructions and adds support for comments, both actual comments and commented out code.

The parser also supports dynamic analysis, it's context aware, example:

COPY . /app

If a static analysis was performed, it would approve the above instruction, Dockter however will actually list the files that are in . and analyze them against known files to contain credentials, but also filter against your .dockerignore file.

Usage

There are a couple of ways you can use Dockter:

  • Local
  • CI/CD

It is suggested to always use both, but at least run it where you are actually building and publishing your images.

Local usage

You will need to install Dockter from pip

pip install --upgrade dockter --extra-index-url https://gitlab.com/api/v4/projects/36078023/packages/pypi/simple
dockter -d path/to/Dockerfile

If you want more information you can either run it in verbose mode or ask to explain a specific rule

# Explain rule dfa001
docker -e dfa001

# Run in verbose mode (this will be a lot of text)
dockter -v -d path/to/Dockerfile

You can also use docker:

docker run -it -v $(pwd):/app registry.gitlab.com/gitlab-org/incubation-engineering/ai-assist/dockter/dockter:latest dockter -d docter.Dockerfile

CI/CD

Usage in GitLab CI example:

dockter:
  image: registry.gitlab.com/gitlab-org/incubation-engineering/ai-assist/dockter/dockter:latest
  stage: lint
  script:
    - dockter -d Dockerfile

Metadata

Release files for pydockter 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydockter 1.0.0
File Size Uploaded Provenance Actions
pydockter-1.0.0.tar.gz 11.9 kB Without provenance Details for pydockter-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydockter 1.0.0
File Interpreter ABI Platform Actions
pydockter-1.0.0-py3-none-any.whl Python 3 none any Details for pydockter-1.0.0-py3-none-any.whl

Total release size: 22.9 kB

Release files / pydockter-1.0.0.tar.gz

Download URL pydockter-1.0.0.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fa976c814e191fb3c0db6790efeec3ccb74ef937bb851682e172c360fe4c1a39
BLAKE2b-256 checksum
How to use checksums
a2542bc7012f2147fca352f229b7b58bb8a417f92a814663591269c4ac86e728
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / pydockter-1.0.0-py3-none-any.whl

Download URL pydockter-1.0.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9208929226a1b71a6f393a1b78024c6cd5f05ded044561c1628e586cf9dcc22
BLAKE2b-256 checksum
How to use checksums
9ca933080eea37db3e825f136de9b76b6e6dacfae4120bc4452bbd4386747a0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Security for pydockter 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page