It seems that docker options are available from version 0.9.37
of digdag.
Release notes: https://docs.digdag.io/releases/release-0.9.37.html?highlight=run_options
Applicable PR: https://github.com/treasure-data/digdag/pull/1025
Quoting from the PR, it seems that you can set as follows.
_export:
docker:
image: ruby:2.5.1
build:
- apt install vim
docker: /usr/local/bin/nvidia-docker
run_options: ["-v", "/tmp:/tmp"]
build_options: ["--pull"]
Here's run_options: ["-v "," / tmp: / tmp "]
, but I wondered if it could be something like run_options: ["-v / tmp: / tmp "]
docker: Error response from daemon: create /: " /" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
I got an error, so I couldn't do it (the same is true for build_options
.)
You can output the debug log with digdag run -l debug
.
--Commands executed when run_options: ["-v "," / tmp: / tmp "]
2019-08-30 19:19:07 +0900 [DEBUG](0017@[0:default]+sample_wf+sample_docker_run_options) io.digdag.standards.command.DockerCommandExecutor: Running in docker: docker run -v /tmp:/tmp -i --rm -v ..Abbreviation
--Commands executed when run_options: ["-v / tmp: / tmp "]
2019-08-30 19:20:22 +0900 [DEBUG](0017@[0:default]+sample_wf+sample_docker_run_options) io.digdag.standards.command.DockerCommandExecutor: Running in docker: docker run -v /tmp:/tmp -i --rm -v ..Abbreviation
The docker
commands displayed in the DEBUG log are ** exactly the same **, and neither seems to be a command problem.
You can execute it by copying only the command and executing it in the local terminal.
I don't get an error like docker: Error response from daemon
above.
run_options
is at this part ʻaddAll is added to ʻImmutableList
declared as command
.
This variable command
is finally passed to ProcessBuilder
as ProcessBuilder docker = new ProcessBuilder (command.build ());
.
ProcessBuilder
doesn't connect the commands together before executing the process, it'scommand.toArray (new String [command.size ()]);
, so run_options: ["-v / tmp: If you define it as / tmp "]
, it will be entered as one command ..?
In other words, ** in terms of image **
--Commands executed when run_options: ["-v "," / tmp: / tmp "]
"docker" "run" "-v" "/tmp:/tmp" "nannka-image:0.1"
--Commands executed when run_options: ["-v / tmp: / tmp "]
"docker" "run" "-v /tmp:/tmp" "nannka-image:0.1"
docker: Error response from daemon
will occur.In the DEBUG log,
logger.debug("Running in docker: {} {}", command.build().stream().collect(Collectors.joining(" ")), imageName);
It seemed that there was no problem with run_options: ["-v / tmp: / tmp "]
, but it was actually executed by ProcessBuilder
, so there was a problem.
It's like, "That's right. That's why it's an array."
If you find something wrong, I would appreciate it if you could point it out.
Recommended Posts