dockerinstall

package
v1.15.1-beta.7 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Channels.
	ChannelStable = "stable"

	// Timeouts.
	DefaultTimeout      = 5 * time.Minute
	ExistingDockerDelay = 20 * time.Second
	WSLWarningDelay     = 20 * time.Second
	DeprecationDelay    = 10 * time.Second
	RetryDelay          = 10 * time.Second

	// Apt options.
	AptTimeoutSeconds = 30
	AptRetries        = 3

	// Paths.
	DefaultDownloadURL = "https://download.docker.com"
	DefaultRepoFile    = "docker-ce.repo"

	// Docker paths.
	DockerBinPath1 = "/usr/bin/docker"
	DockerBinPath2 = "/usr/local/bin/docker"
	DockerBinPath3 = "/bin/docker"
	DockerSocket   = "/var/run/docker.sock"

	// Files.
	OSReleaseFile   = "/etc/os-release"
	ProcVersionFile = "/proc/version"
	DebianVersion   = "/etc/debian_version"

	// Package names.
	PkgDockerCE             = "docker-ce"
	PkgDockerCECLI          = "docker-ce-cli"
	PkgContainerd           = "containerd.io"
	PkgDockerCompose        = "docker-compose-plugin"
	PkgDockerBuildx         = "docker-buildx-plugin"
	PkgDockerScan           = "docker-scan-plugin"
	PkgDockerRootlessExtras = "docker-ce-rootless-extras"

	// Shell commands.
	ShellEcho = "echo"

	// Distro names.
	DistroUbuntu   = "ubuntu"
	DistroRaspbian = "raspbian"
	DistroOSMC     = "osmc"
	DistroDebian   = "debian"
	DistroCentOS   = "centos"
	DistroFedora   = "fedora"
	DistroRHEL     = "rhel"
	DistroSLES     = "sles"

	// Debian release codenames.
	CodenameTrixie   = "trixie"
	CodenameBookworm = "bookworm"
	CodenameBullseye = "bullseye"
	CodenameBuster   = "buster"
	CodenameStretch  = "stretch"
	CodenameJessie   = "jessie"
)

Variables

This section is empty.

Functions

func BuildPackageList

func BuildPackageList(version, pkgVersion, cliPkgVersion string, extraPkgs ...string) string

func Install

func Install(ctx context.Context, stdout, stderr io.Writer) (string, error)

Types

type DebianInstaller

type DebianInstaller struct {
	// contains filtered or unexported fields
}

func NewDebianInstaller

func NewDebianInstaller(distro *Distro, opts *InstallOptions) *DebianInstaller

func (*DebianInstaller) Install

func (i *DebianInstaller) Install(ctx context.Context, shC string) error

type Detector

type Detector struct{}

func NewDetector

func NewDetector() *Detector

func (*Detector) CheckForked

func (d *Detector) CheckForked(distro *Distro) *Distro

func (*Detector) DetectDistro

func (d *Detector) DetectDistro() *Distro

func (*Detector) DetectOS

func (d *Detector) DetectOS() string

func (*Detector) IsWSL

func (d *Detector) IsWSL() bool

type Distro

type Distro struct {
	ID      string
	Version string
}

Distro represents a Linux distribution. ID is the distribution identifier (e.g., "ubuntu", "debian", "fedora"). Version should be a codename (e.g., "jammy", "bookworm") for Debian-based distros, or a version number (e.g., "39") for others like Fedora.

func (*Distro) HasCodename

func (d *Distro) HasCodename() bool

HasCodename returns true if Version is a valid codename (non-numeric).

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

func NewExecutor

func NewExecutor(opts *InstallOptions) *Executor

func (*Executor) Run

func (e *Executor) Run(ctx context.Context, shC, cmdStr string) error

func (*Executor) RunCommands

func (e *Executor) RunCommands(ctx context.Context, shC string, cmds []string) error

func (*Executor) RunCommandsWithRetry

func (e *Executor) RunCommandsWithRetry(
	ctx context.Context,
	shC string,
	cmds []string,
	timeout time.Duration,
) error

func (*Executor) RunWithRetry

func (e *Executor) RunWithRetry(
	ctx context.Context,
	shC, cmdStr string,
	timeout time.Duration,
) error

RunWithRetry runs cmdStr, retrying at RetryDelay intervals while it fails with a dpkg lock error, up to timeout. Any other error returns immediately.

type InstallOptions

type InstallOptions struct {
	// contains filtered or unexported fields
}

type Installer

type Installer interface {
	Install(ctx context.Context, shC string) error
}

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func NewValidator

func NewValidator(opts *InstallOptions) *Validator

func (*Validator) CheckDeprecation

func (v *Validator) CheckDeprecation(distro *Distro)

func (*Validator) CheckExistingDocker

func (v *Validator) CheckExistingDocker()

func (*Validator) CheckWSL

func (v *Validator) CheckWSL(isWSL bool)

func (*Validator) ValidateDistro

func (v *Validator) ValidateDistro(distro *Distro) error

func (*Validator) ValidateOS

func (v *Validator) ValidateOS(os string) error

Jump to

Keyboard shortcuts

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