fix: some test

This commit is contained in:
世界
2022-06-07 10:45:32 +08:00
parent 9126cbab91
commit 73d5042774
12 changed files with 348 additions and 60 deletions

View File

@@ -2,6 +2,8 @@ package main
import (
"context"
"os"
"time"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
@@ -30,6 +32,19 @@ func startContainer(cfg *container.Config, hostCfg *container.HostConfig, name s
return "", err
}
response, err := c.ContainerAttach(context.Background(), container.ID, types.ContainerAttachOptions{
Stdout: true,
Stderr: true,
Logs: true,
})
if err != nil {
return "", err
}
go func() {
response.Reader.WriteTo(os.Stderr)
}()
return container.ID, nil
}