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

fix issue with docker volume on windows #72

Merged
merged 1 commit into from
Feb 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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