dockerpkg

package
v0.4.66 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 4 Imported by: ? 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 dockerpkg knows which of a Debian-family box's packages are Docker's, where the installed Docker came from, and what an apt simulation says it would do to them.

ReCasaOS updates system packages with an apt install of a list, and an upgrade of docker-ce or containerd.io restarts the Docker daemon, which stops every container until it is back. The System packages update therefore leaves this family out and shows it on a line of its own; this package is what tells the two apart. It runs nothing: callers give it text apt printed, and it gives back what is in it. Nothing here is ever built into a shell command from a version string, and a package name reaches a command only if it is one of the fixed names below.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContractPattern

func ContractPattern(protectDocker bool) string

ContractPattern is an extended regular expression (for grep -E) that matches a line of an apt simulation that breaks the contract of the update: any removal, and, when the box has a Docker engine to protect, an install or upgrade of a package of the Docker family. The unit's shell line runs the simulation again just before it installs, and installs nothing if a line matches.

func EngineVersion

func EngineVersion(dpkgVersion string) string

EngineVersion is the upstream version in a dpkg version: "5:29.8.1-1~ubuntu.22.04~jammy" is "29.8.1". It is "" for text that does not start with one.

func IsFamily

func IsFamily(name string) bool

IsFamily reports whether name is one of the Docker engine's packages.

func ManualCommand

func ManualCommand(origin Origin, pending []string) string

ManualCommand is what an owner types to update Docker themselves, for an origin, or "" when there is no command this can stand behind. It names the packages apt says are pending when it said some, so that running it leaves nothing behind, and only names from the fixed family: nothing apt printed reaches it unless it is one of them.

func ManualCommandHeld added in v0.4.66

func ManualCommandHeld(origin Origin, pending []string, held bool) string

ManualCommandHeld is ManualCommand for a package that is on hold: apt refuses to upgrade a held package that is named on the command line unless it is told it may.

func PolicyVersions added in v0.4.66

func PolicyVersions(policy string) (installed, candidate string)

PolicyVersions reads the installed and the candidate version from the output of `apt-cache policy <package>`: the candidate is the newest version apt would install. Each is "" when apt says "(none)" or says nothing.

func RestartsEngine

func RestartsEngine(names []string) bool

RestartsEngine reports whether upgrading any of names restarts Docker.

func ValidName

func ValidName(name string) bool

ValidName reports whether name looks like a Debian package name (with an optional architecture), the only kind of text that may be put into an apt command line.

Types

type Origin

type Origin string

Origin is where the installed Docker came from.

const (
	// OriginDockerRepo is docker-ce from Docker's own apt repository, the one the
	// installer sets up: https://download.docker.com/linux/.
	OriginDockerRepo Origin = "docker-repository"
	// OriginDistribution is the docker.io package of Debian, Ubuntu or Raspberry Pi OS.
	OriginDistribution Origin = "distribution"
	// OriginSnap is the snap.
	OriginSnap Origin = "snap"
	// OriginUnknown is a Docker whose source this does not recognise: a mirror, a plain
	// http repository, a package installed by hand.
	OriginUnknown Origin = "unknown"
)

func OriginFromPolicy

func OriginFromPolicy(policy string) Origin

OriginFromPolicy tells where docker-ce comes from, from the output of `apt-cache policy docker-ce`: Docker's repository when some version of the package is offered by https://download.docker.com/linux/, anything else is unknown.

func (Origin) CanSeeUpdates

func (o Origin) CanSeeUpdates() bool

CanSeeUpdates reports whether apt can tell of an update for an installation from this origin: of a snap, or of a Docker whose source is not known, it cannot.

type Touched

type Touched struct {
	// Docker is the packages of the Docker family it would install or upgrade.
	Docker []string
	// Removed is every package it would remove.
	Removed []string
}

Touched is what an apt simulation (`apt-get -s`) says it would do.

func Touches

func Touches(simulation string) Touched

Touches reads the Inst and Remv lines of an apt simulation.

Jump to

Keyboard shortcuts

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