Documentation
¶
Index ¶
- func AutoDetectWSLDaemon() bool
- type DockerRuntime
- func (d *DockerRuntime) Create(ctx context.Context, spec *types.ContainerSpec) (string, error)
- func (d *DockerRuntime) Delete(ctx context.Context, id string) error
- func (d *DockerRuntime) Describe(ctx context.Context, id string) (*containerruntime.RuntimeDescription, error)
- func (d *DockerRuntime) EnsureImage(ctx context.Context, imageName string, pullPolicy string) error
- func (d *DockerRuntime) Exec(ctx context.Context, id string, cmd []string) (string, error)
- func (d *DockerRuntime) HealthCheck(ctx context.Context) error
- func (d *DockerRuntime) Inspect(ctx context.Context, id string) (*containerruntime.RuntimeInspection, error)
- func (d *DockerRuntime) Logs(ctx context.Context, id string, tail int) (string, error)
- func (d *DockerRuntime) Monitor(ctx context.Context, runtimeID string) error
- func (d *DockerRuntime) Name() string
- func (d *DockerRuntime) OpenTerminal(ctx context.Context, id string, opts containerruntime.TerminalOptions) (containerruntime.TerminalSession, error)
- func (d *DockerRuntime) Pause(ctx context.Context, id string) error
- func (d *DockerRuntime) Resume(ctx context.Context, id string) error
- func (d *DockerRuntime) SetEventHandler(h containerruntime.RuntimeEventHandler)
- func (d *DockerRuntime) Start(ctx context.Context, id string) error
- func (d *DockerRuntime) Stop(ctx context.Context, id string) error
- func (d *DockerRuntime) WSLDaemon() bool
- type DockerRuntimeOption
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) Describe ¶ added in v0.1.4
func (d *DockerRuntime) Describe(ctx context.Context, id string) (*containerruntime.RuntimeDescription, error)
func (*DockerRuntime) EnsureImage ¶
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 (d *DockerRuntime) Inspect(ctx context.Context, id string) (*containerruntime.RuntimeInspection, 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
func (d *DockerRuntime) OpenTerminal(ctx context.Context, id string, opts containerruntime.TerminalOptions) (containerruntime.TerminalSession, error)
OpenTerminal 等价于 `docker exec -it <container> <command>`。
func (*DockerRuntime) SetEventHandler ¶
func (d *DockerRuntime) SetEventHandler(h containerruntime.RuntimeEventHandler)
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 探测构建)。
Click to show internal directories.
Click to hide internal directories.