Skip to content

Example Code not working . #19755

@PranitRout07

Description

@PranitRout07

Is this a docs issue?

  • My issue is about the documentation content or website

Type of issue

Information is incorrect

Description

Code :

package main

import (
	"context"
	"io"
	"os"

	"github.com/docker/docker/api/types"
	"github.com/docker/docker/client"
)

func main() {
	ctx := context.Background()
	cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
	if err != nil {
		panic(err)
	}
	defer cli.Close()

	options := types.ContainerLogsOptions{ShowStdout: true}

	//Container ID
	out, err := cli.ContainerLogs(ctx, "7d68611840b8", options)
	if err != nil {
		panic(err)
	}

	io.Copy(os.Stdout, out)
}

Error :

.\main.go:20:19: undefined: types.ContainerLogsOptions

Location

https://docs.docker.com/engine/api/sdk/examples/

Suggestion

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions