dockerlint

package
v1.5.10 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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