docker

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoDetectWSLDaemon added in v0.2.3

func AutoDetectWSLDaemon() bool

AutoDetectWSLDaemon 依据 DOCKER_HOST 推断是否连接 WSL2 内的 dockerd。

判据:Windows 宿主 + DOCKER_HOST 为 tcp:// 或 http://。 npipe://(Docker Desktop 的 Windows daemon)不参与推断:它的文件系统就是 Windows, bind mount 的 Source 仍应是 Windows 盘符路径。

Types

type DockerRuntime

type DockerRuntime struct {
	// contains filtered or unexported fields
}

func NewDockerRuntime

func NewDockerRuntime(opts ...DockerRuntimeOption) *DockerRuntime

func (*DockerRuntime) Create

func (d *DockerRuntime) Create(ctx context.Context, spec *types.ContainerSpec) (string, error)

func (*DockerRuntime) Delete

func (d *DockerRuntime) Delete(ctx context.Context, id string) error

func (*DockerRuntime) Describe added in v0.1.4

func (*DockerRuntime) EnsureImage

func (d *DockerRuntime) EnsureImage(ctx context.Context, imageName string, pullPolicy string) error

func (*DockerRuntime) Exec

func (d *DockerRuntime) Exec(ctx context.Context, id string, cmd []string) (string, error)

func (*DockerRuntime) HealthCheck added in v0.2.2

func (d *DockerRuntime) HealthCheck(ctx context.Context) error

HealthCheck satisfies containerruntime.RuntimeHealthChecker. 通过 docker client 的 Ping 探测 daemon 是否可达(socket 权限 / daemon 未启动都会在这里暴露)。

func (*DockerRuntime) Inspect

func (*DockerRuntime) Logs

func (d *DockerRuntime) Logs(ctx context.Context, id string, tail int) (string, error)

func (*DockerRuntime) Monitor

func (d *DockerRuntime) Monitor(ctx context.Context, runtimeID string) error

func (*DockerRuntime) Name

func (d *DockerRuntime) Name() string

func (*DockerRuntime) OpenTerminal added in v0.2.0

OpenTerminal 等价于 `docker exec -it <container> <command>`。

func (*DockerRuntime) Pause

func (d *DockerRuntime) Pause(ctx context.Context, id string) error

func (*DockerRuntime) Resume

func (d *DockerRuntime) Resume(ctx context.Context, id string) error

func (*DockerRuntime) SetEventHandler

func (d *DockerRuntime) SetEventHandler(h containerruntime.RuntimeEventHandler)

func (*DockerRuntime) Start

func (d *DockerRuntime) Start(ctx context.Context, id string) error

func (*DockerRuntime) Stop

func (d *DockerRuntime) Stop(ctx context.Context, id string) error

func (*DockerRuntime) WSLDaemon added in v0.2.3

func (d *DockerRuntime) WSLDaemon() bool

WSLDaemon 报告当前是否按 WSL2 daemon 语义翻译挂载路径。

type DockerRuntimeOption added in v0.2.3

type DockerRuntimeOption func(*DockerRuntime)

DockerRuntimeOption 定制 DockerRuntime 的构造。

func WithPathMapper added in v0.2.3

func WithPathMapper(paths *containerruntime.PathMapper) DockerRuntimeOption

WithPathMapper 注入统一路径映射器(由装配层按 storage.base_dir + WSL 探测构建)。

Jump to

Keyboard shortcuts

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