Cromwell support for docker with -w option to change current working directory inside container

I have WDL running with cromwell-28,Local backend with Docker,added -w working_directory in reference.conf file, so command (pwd) available in WDL should run in working_directory.
reference.conf Content of Local Backend

default = "Local"

providers {
Local {
actor-factory = "cromwell.backend.impl.sfs.config.ConfigBackendLifecycleActorFactory"
config {

    # Limits the number of concurrent jobs
    #concurrent-job-limit = 5

    run-in-background = true
    # `script-epilogue` configures a shell command to run after the execution of every command block.
    #
    # If this value is not set explicitly, the default value is `sync`, equivalent to:
    # script-epilogue = "sync"
    #
    # To turn off the default `sync` behavior set this value to an empty string:
    # script-epilogue = ""

    runtime-attributes = """
    String? docker
    String? docker_user
            """
    submit = "/bin/bash ${script}"
    submit-docker = """
    docker run \
      --rm -i \
      ${"--user " + docker_user} \
      --entrypoint /bin/bash \
      -v ${cwd}:${docker_cwd} \
              -w /root/  \
      ${docker} ${script}
    """

example WDL

task testing {

command {
pwd
}
runtime {
docker: "ubuntu:16.04"
}
output {
File out = stdout()
}
}
workflow wf {
call testing
}

In cromwell logs output is showing as below

cat stdout
/cromwell-executions/wf/b662cc0d-6f4a-4b9a-9533-25286c0e1d06/call-testing/execution

Expected output is

/root/

command should return current working directory of host,since we are setting current working directory in docker run command.

Tagged:

Answers

  • ChrisLChrisL Cambridge, MAMember, Broadie, Moderator, Dev ✭✭

    @ishank I just want to make sure I understand the question:

    • You've updated the docker command in your configuration file to make all commands run in the /root/ directory
    • You have a command that runs pwd
    • You expect the output out to be a file that contains the string /root/
      • That's what I'd expect too, what are you in fact seeing?
  • ishankishank Member

    I am getting below output

    cat stdout
    /cromwell-executions/wf/b662cc0d-6f4a-4b9a-9533-25286c0e1d06/call-testing/execution

  • ChrisLChrisL Cambridge, MAMember, Broadie, Moderator, Dev ✭✭

    Oh, I see what's going on, our wrapper script includes a cd to our execution directory before running the contents of the command block.

    Can I ask what the requirement for this is? Can you use cd in your command before the pwd? eg

    command {
      cd /root/
      pwd
    }
    
Sign In or Register to comment.