MCPcopy Index your code
hub / github.com/cortexlabs/cortex / StreamDockerLogsFn

Function StreamDockerLogsFn

pkg/lib/docker/docker.go:229–248  ·  view source on GitHub ↗
(containerID string, dockerClient *Client)

Source from the content-addressed store, hash-verified

227}
228
229func StreamDockerLogsFn(containerID string, dockerClient *Client) func() error {
230 return func() error {
231 // Use ContainerLogs() so lines are only printed once they end in \n
232 logsOutput, err := dockerClient.ContainerLogs(context.Background(), containerID, dockertypes.ContainerLogsOptions{
233 ShowStdout: true,
234 ShowStderr: true,
235 Follow: true,
236 })
237 if err != nil {
238 return WrapDockerError(err)
239 }
240
241 _, err = io.Copy(os.Stdout, logsOutput)
242 if err != nil && err != io.EOF {
243 return errors.WithStack(err)
244 }
245
246 return nil
247 }
248}
249
250// The provided input will be extracted into the container's containerPath directory
251func CopyToContainer(containerID string, input *archive.Input, containerPath string) error {

Callers 1

StreamDockerLogsFunction · 0.85

Calls 3

WithStackFunction · 0.92
WrapDockerErrorFunction · 0.85
CopyMethod · 0.45

Tested by

no test coverage detected