@@ -2,12 +2,10 @@ package containermanger
22
33import (
44 "errors"
5- "fmt"
6-
75 "github.com/docker/docker/api/types/volume"
86)
97
10- // Create a new volume, return id of the volume
8+ // CreateVolume : Create a new volume, return id of the volume
119func (m Manager ) CreateVolume (name string ) error {
1210 _ , err := m .client .VolumeCreate (m .ctx , volume.CreateOptions {
1311 Name : name ,
@@ -18,7 +16,7 @@ func (m Manager) CreateVolume(name string) error {
1816 return nil
1917}
2018
21- // Remove a volume by id
19+ // RemoveVolume : Remove a volume by id
2220func (m Manager ) RemoveVolume (id string ) error {
2321 err := m .client .VolumeRemove (m .ctx , id , true )
2422 if err != nil {
@@ -27,14 +25,13 @@ func (m Manager) RemoveVolume(id string) error {
2725 return nil
2826}
2927
30- // Check if volume exists
28+ // ExistsVolume : Check if volume exists
3129func (m Manager ) ExistsVolume (id string ) bool {
32- d , err := m .client .VolumeInspect (m .ctx , id )
33- fmt .Println (d )
30+ _ , err := m .client .VolumeInspect (m .ctx , id )
3431 return err == nil
3532}
3633
37- // Fetch all volumes
34+ // FetchVolumes Fetch all volumes
3835func (m Manager ) FetchVolumes () ([]string , error ) {
3936 volumes , err := m .client .VolumeList (m .ctx , volume.ListOptions {})
4037 if err != nil {
0 commit comments