job "volume-chown" { datacenters = ["dc1"] type = "batch" group "volume-chown" { volume "volume" { type = "csi" source = var.vol access_mode = "single-node-writer" attachment_mode = "file-system" } task "volume-chown" { driver = "docker" config { image = "busybox:latest" userns_mode = "host" command = "chown" args = [ "-R", var.owner, "/data" ] } volume_mount { volume = "volume" destination = "/data" } resources { cpu = 10 memory = 128 } } } } variable "vol" { type = string default = "" } variable "owner" { type = string default = "100000:100000" }