mirror of
https://github.com/tuna/tunasync.git
synced 2025-06-15 14:12:47 +00:00
feat(worker): map current uid and gid to docker
This commit is contained in:
parent
d4e07a7b29
commit
d5a438462f
@ -41,13 +41,17 @@ func newCmdJob(provider mirrorProvider, cmdAndArgs []string, workingDir string,
|
|||||||
"--name", d.Name(),
|
"--name", d.Name(),
|
||||||
"-w", workingDir,
|
"-w", workingDir,
|
||||||
}
|
}
|
||||||
|
// specify user
|
||||||
|
args = append(
|
||||||
|
args, "-u",
|
||||||
|
fmt.Sprintf("%d:%d", os.Getuid(), os.Getgid()),
|
||||||
|
)
|
||||||
// add volumes
|
// add volumes
|
||||||
for _, vol := range d.Volumes() {
|
for _, vol := range d.Volumes() {
|
||||||
logger.Debugf("volume: %s", vol)
|
logger.Debugf("volume: %s", vol)
|
||||||
args = append(args, "-v", vol)
|
args = append(args, "-v", vol)
|
||||||
}
|
}
|
||||||
// set env
|
// set env
|
||||||
env["TUNASYNC_LOG_FILE"] = d.LogFile()
|
|
||||||
for k, v := range env {
|
for k, v := range env {
|
||||||
kv := fmt.Sprintf("%s=%s", k, v)
|
kv := fmt.Sprintf("%s=%s", k, v)
|
||||||
args = append(args, "-e", kv)
|
args = append(args, "-e", kv)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user