Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Commit

Permalink
fix issue with docker volume on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
everettraven committed Feb 27, 2022
1 parent 054d360 commit 461b5cf
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions utils/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,30 @@ func (u *Utility) RunContainer(image string, ports []string, volumes []string, c

// add the volumes to the command
for _, vol := range volumes {
// Define variables needed for volume parsing
var source string
var target string
var options string

// If the host is a windows machine we need to remove the 'C:' and add it again later
if runtime.GOOS == "windows" {
vol = strings.TrimLeft(vol, "c:")
source += "C:"
}

if vErr := u.validateRunContainerVolume(vol); vErr != nil {
return "", vErr
}

splitVol := strings.Split(vol, ":")
var source string
var target string
var options string

if len(splitVol) == 3 {
source = splitVol[0]
target = splitVol[1]
options = ":" + splitVol[2]
source += splitVol[0]
target += splitVol[1]
options += ":" + splitVol[2]
} else {
source = splitVol[0]
target = splitVol[1]
source += splitVol[0]
target += splitVol[1]
}

source, err := filepath.Abs(source)
Expand Down

0 comments on commit 461b5cf

Please sign in to comment.