Help us shape the future of Go! Take the 2026 Go Developer Survey

container

package
v0.1.66 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package container follows Docker Engine API logs through a unix socket. DOCKER_HOST selects a unix socket; when unset, /var/run/docker.sock is used. A Podman Docker-compatible socket can be used with Runtime set to "podman". Containerd's native API and TTY streams are not supported.

FollowOptions.Container selects an ID or name, Since bounds the start time, Tail passes Docker's tail value, and Follow keeps the stream open. Emit is called synchronously for each line and should return promptly. Host defaults to the local hostname and Runtime defaults to "docker". Lines reaching 64 KiB are emitted in chunks with the label truncated=true. Cancellation flushes partial lines and returns the unwrapped context error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Follow

func Follow(ctx context.Context, opts FollowOptions) (result error)

Follow emits lines until the stream ends or the context is cancelled.

Types

type FollowOptions

type FollowOptions struct {
	Container string
	Host      string
	Runtime   string
	Since     time.Time
	Tail      string
	Follow    bool
	Emit      func(logs.LogLine)
}

FollowOptions selects a container and controls the Docker logs request.

Jump to

Keyboard shortcuts

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