@@ -178,7 +178,7 @@ func CreateAndRunContainer(containerName string, imageName string, portMap map[s
178178 return fmt .Errorf ("ContainerCreate: %w" , err )
179179 }
180180
181- if err := cli .ContainerStart (ctx , resp .ID , types. ContainerStartOptions {}); err != nil {
181+ if err := cli .ContainerStart (ctx , resp .ID , container. StartOptions {}); err != nil {
182182 return fmt .Errorf ("ContainerStart: %w" , err )
183183 }
184184
@@ -482,7 +482,7 @@ func ExtractFromImage(imageName, localPath, containerPath string) error {
482482 }
483483 containerID := resp .ID
484484 defer func () {
485- if err := cli .ContainerRemove (ctx , containerID , types. ContainerRemoveOptions {Force : true }); err != nil {
485+ if err := cli .ContainerRemove (ctx , containerID , container. RemoveOptions {Force : true }); err != nil {
486486 log .Errorf ("ContainerRemove error: %s" , err )
487487 }
488488 }()
@@ -522,7 +522,7 @@ func StopContainer(containerName string, remove bool) error {
522522 return err
523523 }
524524
525- containers , err := cli .ContainerList (context .Background (), types. ContainerListOptions {All : true })
525+ containers , err := cli .ContainerList (context .Background (), container. ListOptions {All : true })
526526 if err != nil {
527527 return err
528528 }
@@ -537,14 +537,14 @@ func StopContainer(containerName string, remove bool) error {
537537 if isFound {
538538 if cont .State != "running" {
539539 if remove {
540- if err = cli .ContainerRemove (ctx , cont .ID , types. ContainerRemoveOptions {}); err != nil {
540+ if err = cli .ContainerRemove (ctx , cont .ID , container. RemoveOptions {}); err != nil {
541541 return err
542542 }
543543 }
544544 return nil
545545 }
546546 if remove {
547- if err = cli .ContainerRemove (ctx , cont .ID , types. ContainerRemoveOptions {Force : true }); err != nil {
547+ if err = cli .ContainerRemove (ctx , cont .ID , container. RemoveOptions {Force : true }); err != nil {
548548 return err
549549 }
550550 } else {
@@ -569,7 +569,7 @@ func StateContainer(containerName string) (state string, err error) {
569569 return "" , err
570570 }
571571
572- containers , err := cli .ContainerList (context .Background (), types. ContainerListOptions {All : true })
572+ containers , err := cli .ContainerList (context .Background (), container. ListOptions {All : true })
573573 if err != nil {
574574 return "" , err
575575 }
@@ -596,7 +596,7 @@ func StartContainer(containerName string) error {
596596 return err
597597 }
598598
599- containers , err := cli .ContainerList (context .Background (), types. ContainerListOptions {All : true })
599+ containers , err := cli .ContainerList (context .Background (), container. ListOptions {All : true })
600600 if err != nil {
601601 return err
602602 }
@@ -609,7 +609,7 @@ func StartContainer(containerName string) error {
609609 }
610610 }
611611 if isFound {
612- if err = cli .ContainerStart (ctx , cont .ID , types. ContainerStartOptions {}); err != nil {
612+ if err = cli .ContainerStart (ctx , cont .ID , container. StartOptions {}); err != nil {
613613 return err
614614 }
615615 break
@@ -666,7 +666,7 @@ func RunDockerCommand(image string, command string, volumeMap map[string]string)
666666 if err != nil {
667667 return "" , err
668668 }
669- if err := cli .ContainerStart (ctx , resp .ID , types. ContainerStartOptions {}); err != nil {
669+ if err := cli .ContainerStart (ctx , resp .ID , container. StartOptions {}); err != nil {
670670 return "" , err
671671 }
672672 statusCh , errCh := cli .ContainerWait (ctx , resp .ID , container .WaitConditionNotRunning )
@@ -679,14 +679,14 @@ func RunDockerCommand(image string, command string, volumeMap map[string]string)
679679
680680 }
681681
682- out , err := cli .ContainerLogs (ctx , resp .ID , types. ContainerLogsOptions {ShowStdout : true , ShowStderr : true })
682+ out , err := cli .ContainerLogs (ctx , resp .ID , container. LogsOptions {ShowStdout : true , ShowStderr : true })
683683 if err != nil {
684684 return "" , err
685685 }
686686 defer out .Close ()
687687 b , err := io .ReadAll (out )
688688
689- if err := cli .ContainerRemove (ctx , resp .ID , types. ContainerRemoveOptions {RemoveVolumes : true }); err != nil {
689+ if err := cli .ContainerRemove (ctx , resp .ID , container. RemoveOptions {RemoveVolumes : true }); err != nil {
690690 log .Errorf ("ContainerRemove error: %s" , err )
691691 }
692692
0 commit comments