docker

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrComposeNotFound = errors.New("Docker Compose not found: install the Docker Compose plugin (`docker compose`) or the standalone `docker-compose` binary")

ErrComposeNotFound is returned when neither the standalone `docker-compose` binary nor the `docker compose` plugin is available.

Functions

func CalculateDirSize

func CalculateDirSize(path string) (int64, error)

func ComposeCommand added in v0.3.0

func ComposeCommand(args ...string) (*exec.Cmd, error)

ComposeCommand returns a command that runs Docker Compose with args.

func ComposeVersionOutput added in v0.3.0

func ComposeVersionOutput() (string, error)

ComposeVersionOutput returns Docker Compose's own version banner.

The standalone binary and the plugin use different invocations to print it ("docker-compose --version" vs "docker compose version" — the plugin treats "--version" as an unrecognized global flag and prints its help text instead), so this cannot be expressed as a plain ComposeCommand("--version") call.

Some systems install a `docker-compose` file that isn't the real standalone binary but a compatibility shim forwarding straight to `docker compose` (`exec docker compose "$@"`) — LookPath alone can't tell it apart from the real thing, since both are just an executable named "docker-compose". Such a shim doesn't understand --version either, so if that attempt doesn't look like a version banner, it's retried with the bare "version" subcommand, which works whether "docker-compose" is genuine or a plugin-forwarding shim.

func CreateVolume

func CreateVolume(volumeName string) error

func ForceRemoveAll added in v0.3.0

func ForceRemoveAll(path string) error

ForceRemoveAll removes path, which may contain files a Docker container wrote as its own internal UID (typically via `gosu nodeuser` in the fiftysix images' entrypoints). On native Linux, unlike Docker Desktop on macOS, a bind mount does not remap that UID onto the host user, so the host process running nodevin can genuinely lack permission to unlink files its own container created.

It tries a normal os.RemoveAll first, which is enough whenever there is no such mismatch (macOS, or a Linux setup where the container happens to run as the host user's own UID). Only on a permission error does it fall back to removing path from inside a throwaway container running as root, which can delete the files regardless of their host-visible owning UID.

func InitDockerClient

func InitDockerClient() error

func ListVolumes

func ListVolumes() (string, error)

func PullImage

func PullImage(image string) error

func RemoveVolume

func RemoveVolume(volumeName string) (bool, error)

Types

type VolumeDetails

type VolumeDetails struct {
	Name        string
	Size        int
	Mountpoint  string
	DateCreated string
}

func ListVolumeDetails

func ListVolumeDetails(network string) (*VolumeDetails, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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