'Mount relative folder within a docker task within nomad
I'm new to nomad and I try to move from docker-compose files in which I'm used to mount folders to a relative location of the docker-compose.yml file.
I've trouble understanding how I can reproduce this behavior using nomad.
If I were to do it manually I would do something using the $PWD env var: docker run --rm -it -v $PWD/packs/hello_pack:/app node bash
Unfortunately I can't find any example of a bind mount a relative folder with nomad.
I tried without any luck
task "server" {
driver = "docker"
config {
image= "node:lts-buster-slim"
mount {
type = "bind"
target = "/app"
source = "./"
}
…
}
}
I think this is a convenient feature to have during development phase.
Is there a way to mount a folder relative to the current directory (or something similar)?
Solution 1:[1]
I think this should do: https://www.nomadproject.io/docs/drivers/docker#volumes
config {
volumes = [
# Use absolute paths to mount arbitrary paths on the host
"/path/on/host:/path/in/container",
# Use relative paths to rebind paths already in the allocation dir
"relative/to/task:/also/in/container"
]
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Stas |
