feat: 新增 proc nohup 后台运行、docker save/load 内置实现,移除 Podman 支持
- proc.nohup:后台运行命令并将 stdout/stderr 追加写入日志, Unix 下新会话、Windows 下 DETACHED_PROCESS 脱离终端 - docker.save:等价 docker save <镜像> -o <镜像名>.tar,文件名按 仓库名+标签生成(alpine:3.20 → alpine_3.20.tar),传镜像 ID 时 先解析出对应名称;docker.load 改为归档文件作位置参数 - 移除 Podman 支持,所有容器命令只走 docker
This commit is contained in:
@@ -21,7 +21,7 @@ type Info struct {
|
||||
Arch string // runtime.GOARCH, e.g. "amd64", "arm64"
|
||||
Distro string // lower-case os-release ID, empty when unknown
|
||||
DistroLike []string // lower-case os-release ID_LIKE entries
|
||||
Runtimes []string // container runtimes found on PATH, e.g. "docker", "podman"
|
||||
Runtimes []string // container runtimes found on PATH, e.g. "docker"
|
||||
}
|
||||
|
||||
// Probe gathers Info. Its dependencies are injectable so detection can be
|
||||
@@ -41,7 +41,7 @@ func System() Probe {
|
||||
GOARCH: runtime.GOARCH,
|
||||
ReadFile: os.ReadFile,
|
||||
LookPath: exec.LookPath,
|
||||
RuntimeCandidates: []string{"docker", "podman"},
|
||||
RuntimeCandidates: []string{"docker"},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ func (p Probe) Detect() Info {
|
||||
|
||||
candidates := p.RuntimeCandidates
|
||||
if candidates == nil {
|
||||
candidates = []string{"docker", "podman"}
|
||||
candidates = []string{"docker"}
|
||||
}
|
||||
if p.LookPath != nil {
|
||||
for _, name := range candidates {
|
||||
|
||||
@@ -77,18 +77,6 @@ func TestDetect(t *testing.T) {
|
||||
Runtimes: []string{"docker"},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "linux centos with podman and docker",
|
||||
goos: "linux",
|
||||
goarch: "arm64",
|
||||
osRelease: centosStream9,
|
||||
present: []string{"docker", "podman"},
|
||||
want: Info{
|
||||
OS: "linux", Arch: "arm64",
|
||||
Distro: "centos", DistroLike: []string{"rhel", "fedora"},
|
||||
Runtimes: []string{"docker", "podman"},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "linux without os-release",
|
||||
goos: "linux",
|
||||
@@ -133,7 +121,7 @@ func TestDetect(t *testing.T) {
|
||||
}
|
||||
return "", errors.New("not found")
|
||||
},
|
||||
RuntimeCandidates: []string{"docker", "podman"},
|
||||
RuntimeCandidates: []string{"docker"},
|
||||
}
|
||||
|
||||
got := probe.Detect()
|
||||
|
||||
Reference in New Issue
Block a user