diff --git a/cmd/util/volumes.go b/cmd/util/volumes.go index 302b1fe6..874c4d5f 100644 --- a/cmd/util/volumes.go +++ b/cmd/util/volumes.go @@ -40,8 +40,11 @@ func ValidateVolumeMount(runtime runtimes.Runtime, volumeMount string) (string, // validate 'SRC[:DEST]' substring split := strings.Split(volumeMount, ":") - if len(split) < 1 || len(split) > 2 { - return "", fmt.Errorf("Invalid volume mount '%s': only one ':' allowed", volumeMount) + if len(split) < 1 { + return "", fmt.Errorf("No volume/path specified") + } + if len(split) > 3 { + return "", fmt.Errorf("Invalid volume mount '%s': maximal 2 ':' allowed", volumeMount) } // we only have SRC specified -> DEST = SRC @@ -58,12 +61,11 @@ func ValidateVolumeMount(runtime runtimes.Runtime, volumeMount string) (string, // a) named volume isNamedVolume := true if err := verifyNamedVolume(runtime, src); err != nil { - log.Debugf("Source '%s' is not a named volume, assuming it's a path...\n%+v", src, err) isNamedVolume = false } if !isNamedVolume { if _, err := os.Stat(src); err != nil { - return "", fmt.Errorf("Failed to stat file/dir that you're trying to mount: '%s' in '%s'", src, volumeMount) + log.Warnf("Failed to stat file/directory/named volume that you're trying to mount: '%s' in '%s' -> Please make sure it exists", src, volumeMount) } } } @@ -73,7 +75,7 @@ func ValidateVolumeMount(runtime runtimes.Runtime, volumeMount string) (string, return "", fmt.Errorf("Volume mount destination doesn't appear to be an absolute path: '%s' in '%s'", dest, volumeMount) } - return fmt.Sprintf("%s:%s", src, dest), nil + return volumeMount, nil } // verifyNamedVolume checks whether a named volume exists in the runtime diff --git a/pkg/runtimes/docker/translate.go b/pkg/runtimes/docker/translate.go index 0020b14b..af169337 100644 --- a/pkg/runtimes/docker/translate.go +++ b/pkg/runtimes/docker/translate.go @@ -39,7 +39,9 @@ func TranslateNodeToContainer(node *k3d.Node) (*NodeInDocker, error) { /* initialize everything that we need */ containerConfig := docker.Config{} - hostConfig := docker.HostConfig{} + hostConfig := docker.HostConfig{ + Init: &[]bool{true}[0], + } networkingConfig := network.NetworkingConfig{} /* Name & Image */ @@ -76,7 +78,7 @@ func TranslateNodeToContainer(node *k3d.Node) (*NodeInDocker, error) { hostConfig.Privileged = true /* Volumes */ - // TODO: image volume + log.Debugf("Volumes: %+v", node.Volumes) hostConfig.Binds = node.Volumes // containerConfig.Volumes = map[string]struct{}{} // TODO: do we need this? We only used binds before