|
|
@ -157,25 +157,32 @@ func (b Backend) ExecDocker(l Location, args []string) (string, error) {
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
volume := l.getVolumeName()
|
|
|
|
volume := l.From[0]
|
|
|
|
path, _ := l.getPath()
|
|
|
|
|
|
|
|
options := ExecuteOptions{
|
|
|
|
options := ExecuteOptions{
|
|
|
|
Command: "docker",
|
|
|
|
Command: "docker",
|
|
|
|
Envs: env,
|
|
|
|
Envs: env,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dir := "/data"
|
|
|
|
docker := []string{
|
|
|
|
docker := []string{
|
|
|
|
"run", "--rm",
|
|
|
|
"run", "--rm",
|
|
|
|
"--entrypoint", "ash",
|
|
|
|
"--entrypoint", "ash",
|
|
|
|
"--workdir", path,
|
|
|
|
"--workdir", dir,
|
|
|
|
"--volume", volume + ":" + path,
|
|
|
|
"--volume", volume + ":" + dir,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Use of docker host, not the container host
|
|
|
|
if hostname, err := os.Hostname(); err == nil {
|
|
|
|
if hostname, err := os.Hostname(); err == nil {
|
|
|
|
docker = append(docker, "--hostname", hostname)
|
|
|
|
docker = append(docker, "--hostname", hostname)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if b.Type == "local" {
|
|
|
|
switch b.Type {
|
|
|
|
|
|
|
|
case "local":
|
|
|
|
actual := env["RESTIC_REPOSITORY"]
|
|
|
|
actual := env["RESTIC_REPOSITORY"]
|
|
|
|
docker = append(docker, "--volume", actual+":"+"/repo")
|
|
|
|
docker = append(docker, "--volume", actual+":"+"/repo")
|
|
|
|
env["RESTIC_REPOSITORY"] = "/repo"
|
|
|
|
env["RESTIC_REPOSITORY"] = "/repo"
|
|
|
|
|
|
|
|
case "b2":
|
|
|
|
|
|
|
|
case "s3":
|
|
|
|
|
|
|
|
// No additional setup needed
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return "", fmt.Errorf("Backend type \"%s\" is not supported as volume endpoint", b.Type)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for key, value := range env {
|
|
|
|
for key, value := range env {
|
|
|
|
docker = append(docker, "--env", key+"="+value)
|
|
|
|
docker = append(docker, "--env", key+"="+value)
|
|
|
|