docker

package
v3.3.6 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command added in v3.3.2

func Command(sock string, args ...string) string

Command 拼接指向指定套接字的 docker 命令,各参数均做转义

func CopyLogs added in v3.2.5

func CopyLogs(dst io.Writer, src io.Reader, tty bool) error

CopyLogs 将容器日志流写入 dst。 非 TTY 容器的日志是多路复用流(每帧带 8 字节头),需用 stdcopy 解复用; 传入同一个 writer 作为 stdout/stderr 两路目标,以保持原始时序。 TTY 容器为裸流,直接拷贝即可。

func ImagePullShell added in v3.3.2

func ImagePullShell(sock string, req *request.ContainerImagePull) (string, string, error)

ImagePullShell 生成拉取镜像的命令,需要认证时返回配套的清理命令

func RunShell added in v3.3.2

func RunShell(sock string, req *request.ContainerCreate) (string, error)

RunShell 生成后台创建容器的命令

Types

type MessageResize

type MessageResize struct {
	Resize  bool `json:"resize"`
	Columns uint `json:"columns"`
	Rows    uint `json:"rows"`
}

MessageResize 终端大小调整消息

type Turn

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

Turn 容器终端转发器

func NewTurn

func NewTurn(ctx context.Context, ws *websocket.Conn, containerID string, command []string, sock string) (*Turn, error)

NewTurn 创建容器终端转发器

func (*Turn) Close

func (t *Turn) Close()

Close 关闭连接

func (*Turn) Handle

func (t *Turn) Handle(ctx context.Context) error

Handle 处理 WebSocket 消息

func (*Turn) Wait

func (t *Turn) Wait()

Wait 等待容器输出并转发到 WebSocket

func (*Turn) Write

func (t *Turn) Write(p []byte) (n int, err error)

Write 实现 io.Writer 接口,将容器输出写入 WebSocket

Jump to

Keyboard shortcuts

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