dockerlint

package
v0.8.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package dockerlint checks a Dockerfile for the handful of hints that most often cause production trouble and offers a safe patch where one exists.

Index

Constants

View Source
const (
	RuleRootUser    = "root-user"
	RuleHealthcheck = "no-healthcheck"
	RuleMultiStage  = "single-stage-build"
	RuleDockerignor = "no-dockerignore"
	RuleFloatingTag = "floating-base-tag"

	SeverityWarn = "warn"
	SeverityInfo = "info"

	// NonRootUser is a numeric UID:GID so the patch works on images that ship no named user.
	NonRootUser = "65532:65532"
)

Rule IDs and severities, shared by the API, CLI and UI.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finding

type Finding struct {
	Rule     string `json:"rule"`
	Severity string `json:"severity"`
	Line     int    `json:"line"`
	Message  string `json:"message"`
	Fixable  bool   `json:"fixable"`
}

Finding is one hint. Line is 1-based, 0 when it applies to the whole file.

type Result

type Result struct {
	Findings         []Finding `json:"findings"`
	FixedDockerfile  string    `json:"fixed_dockerfile"`
	DockerignoreHint string    `json:"dockerignore_suggestion,omitempty"`
}

Result is the lint output plus the patched file and suggested .dockerignore.

func Lint

func Lint(dockerfile string, hasDockerignore bool) Result

Lint inspects dockerfile. hasDockerignore says whether the build context ships a .dockerignore.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL