import ( "github.com/docker/docker/cli/command" ) cli := command.NewDockerCli() err := cli.CmdBuild([]string{"-t", "myimage", "."}) if err != nil { fmt.Println("Error building image: ", err) }
import ( "github.com/docker/docker/cli/command" ) cli := command.NewDockerCli() err := cli.CmdStart([]string{"mycontainer"}) if err != nil { fmt.Println("Error starting container: ", err) }In this example, we create an instance of the Docker CLI and use the CmdStart function to start a previously created container with the name "mycontainer". Overall, the go github.com/docker/docker/cli/command package provides a comprehensive set of functions and structs for interacting with the Docker CLI via code.