Documentation
¶
Index ¶
- Variables
- func CalculateDirSize(path string) (int64, error)
- func ComposeCommand(args ...string) (*exec.Cmd, error)
- func ComposeVersionOutput() (string, error)
- func CreateVolume(volumeName string) error
- func ForceRemoveAll(path string) error
- func InitDockerClient() error
- func ListVolumes() (string, error)
- func PullImage(image string) error
- func RemoveVolume(volumeName string) (bool, error)
- type VolumeDetails
Constants ¶
This section is empty.
Variables ¶
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 ComposeCommand ¶ added in v0.3.0
ComposeCommand returns a command that runs Docker Compose with args.
func ComposeVersionOutput ¶ added in v0.3.0
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 ForceRemoveAll ¶ added in v0.3.0
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 RemoveVolume ¶
Types ¶
type VolumeDetails ¶
func ListVolumeDetails ¶
func ListVolumeDetails(network string) (*VolumeDetails, error)