[JAVA] I tried a little digdag docker.run_options

digdag docker.run_options

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.)

Take a look at digdag's DEBUG log

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.

Then why not

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"

Summary

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

I tried a little digdag docker.run_options
I tried playing with BottomNavigationView a little ①
I tried to decorate the simple calendar a little
I tried embedding a formula in Javadoc
I tried Spring.
I tried tomcat
I tried youtubeDataApi.
I tried refactoring ①
I tried FizzBuzz.
I tried JHipster 5.1
[Personal memo] I learned a little about modifiers
java I tried to break a simple block
I tried to develop a man-hour management tool
I tried to develop a DUO3.0 study website.
I tried hitting a Java method from ABCL
I tried to create a LINE clone app
I tried running Ansible on a Docker container
I tried setting up a Maven remote repository
I tried to develop a website to record expenses.
I tried to implement a server using Netty
I tried to break a block with java (1)
I tried running Java on a Mac terminal
[Small story] I tried to make the java ArrayList a little more convenient
I tried using a database connection in Android development
I tried running Autoware
I tried using Gson
I tried QUARKUS immediately
I want to use a little icon in Rails
I tried to create a Clova skill in Java
I tried to make a login function in Java
I tried using TestNG
I tried using Log4j2 on a Java EE server
I tried Spring Batch
I tried using Galasa
I tried OCR processing a PDF file with Java
I tried node-jt400 (Programs)
I tried node-jt400 (execute)
I tried scraping a stock chart using Java (Jsoup)
I tried node-jt400 (Transactions)
I tried to create a java8 development environment with Chocolatey
I tried using the GitHub repository as a library server
I tried adding a separator line to TabLayout on Android
I tried to modernize a Java EE application with OpenShift.
[Rails] I tried to create a mini app with FullCalendar
I tried JAX-RS and made a note of the procedure
I tried using Hotwire to make Rails 6.1 scaffold a SPA
I tried to build the environment little by little using docker
I tried to convert a string to a LocalDate type in Java
I tried running a Docker container on AWS IoT Greengrass 2.0
I tried to implement a buggy web application in Kotlin
I tried to make a client of RESAS-API in Java
I tried to create a padrino development environment with Docker
I tried OCR processing a PDF file with Java part2
I tried node-jt400 (Environment construction)
I tried DI with Ruby
I tried node-jt400 (IFS write)
I tried node-jt400 (SQL Update)
I made a chat app.
I tried using azure cloud-init
I tried Spring State machine
I tried Drools (Java, InputStream)