mirror of
https://github.com/kemko/nomad.git
synced 2026-01-03 17:05:43 +03:00
Volume binds for windows containers
This commit is contained in:
@@ -7,11 +7,20 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
var (
|
||||
//Path inside container for mounted directory shared across tasks in a task group.
|
||||
SharedAllocContainerPath = filepath.Join("/", SharedAllocName)
|
||||
|
||||
//Path inside container for mounted directory for local storage.
|
||||
TaskLocalContainerPath = filepath.Join("/", TaskLocal)
|
||||
)
|
||||
|
||||
func (d *AllocDir) linkOrCopy(src, dst string, perm os.FileMode) error {
|
||||
// Attempt to hardlink.
|
||||
if err := os.Link(src, dst); err == nil {
|
||||
|
||||
@@ -3,6 +3,15 @@ package allocdir
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
var (
|
||||
//Path inside container for mounted directory that is shared across tasks in a task group.
|
||||
SharedAllocContainerPath = filepath.Join("c:\\", SharedAllocName)
|
||||
|
||||
//Path inside container for mounted directory for local storage.
|
||||
TaskLocalContainerPath = filepath.Join("c:\\", TaskLocal)
|
||||
)
|
||||
|
||||
func (d *AllocDir) linkOrCopy(src, dst string, perm os.FileMode) error {
|
||||
|
||||
@@ -321,8 +321,8 @@ func (d *DockerDriver) containerBinds(alloc *allocdir.AllocDir, task *structs.Ta
|
||||
return nil, fmt.Errorf("Failed to find task local directory: %v", task.Name)
|
||||
}
|
||||
|
||||
allocDirBind := fmt.Sprintf("%s:/%s", shared, allocdir.SharedAllocName)
|
||||
taskLocalBind := fmt.Sprintf("%s:/%s", local, allocdir.TaskLocal)
|
||||
allocDirBind := fmt.Sprintf("%s:%s", shared, allocdir.SharedAllocContainerPath)
|
||||
taskLocalBind := fmt.Sprintf("%s:%s", local, allocdir.TaskLocalContainerPath)
|
||||
|
||||
if selinuxLabel := d.config.Read("docker.volumes.selinuxlabel"); selinuxLabel != "" {
|
||||
allocDirBind = fmt.Sprintf("%s:%s", allocDirBind, selinuxLabel)
|
||||
@@ -351,8 +351,8 @@ func (d *DockerDriver) createContainer(ctx *ExecContext, task *structs.Task,
|
||||
}
|
||||
|
||||
// Set environment variables.
|
||||
d.taskEnv.SetAllocDir(filepath.Join("/", allocdir.SharedAllocName))
|
||||
d.taskEnv.SetTaskLocalDir(filepath.Join("/", allocdir.TaskLocal))
|
||||
d.taskEnv.SetAllocDir(allocdir.SharedAllocContainerPath)
|
||||
d.taskEnv.SetTaskLocalDir(allocdir.TaskLocalContainerPath)
|
||||
|
||||
config := &docker.Config{
|
||||
Image: driverConfig.ImageName,
|
||||
|
||||
Reference in New Issue
Block a user