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 ¶
- func ContractPattern(protectDocker bool) string
- func EngineVersion(dpkgVersion string) string
- func IsFamily(name string) bool
- func ManualCommand(origin Origin, pending []string) string
- func ManualCommandHeld(origin Origin, pending []string, held bool) string
- func PolicyVersions(policy string) (installed, candidate string)
- func RestartsEngine(names []string) bool
- func ValidName(name string) bool
- type Origin
- type Touched
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContractPattern ¶
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 ¶
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 ManualCommand ¶
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
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
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 ¶
RestartsEngine reports whether upgrading any of names restarts Docker.
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 ¶
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 ¶
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.