Class ProcessBuilderDocker

All Implemented Interfaces:
Cloneable, IProcessBuilderCore<ProcessBuilderDocker>

public class ProcessBuilderDocker extends InvokableProcessBuilderBase<ProcessBuilderDocker>
Process builder that starts a process in a docker container via docker run.
  • Field Details

  • Constructor Details

    • ProcessBuilderDocker

      public ProcessBuilderDocker()
  • Method Details

    • supportsAnonPipeRead

      public boolean supportsAnonPipeRead()
      Description copied from interface: IProcessBuilderCore
      Whether the process builder can read from anonymous pipes. Docker containers can only bind-mount named pipes but not anonymous pipes. When building pipelines, this flag is used to avoid needless intermediate anon pipes where named ones can be used directly. For pipelines, this is the value of the first process builder.
    • supportsAnonPipeWrite

      public boolean supportsAnonPipeWrite()
      Description copied from interface: IProcessBuilderCore
      Whether the process builder can write to an anonymous pipe. Docker containers can only bind-mount named pipes but not anonymous pipes. When building pipelines, this flag is used to avoid needless intermediate anon pipes where named ones can be used directly. For pipelines, this is the value of the last process builder.
    • supportsDirectNamedPipe

      public boolean supportsDirectNamedPipe()
      Description copied from interface: IProcessBuilderCore
      Whether a named pipe can be used with the process builder without risking blocking due to multiple connections being made to it. This method must only return true if only a single connection to that pipe will be openend. A process builder for host or docker may return true. But a group with two or more 'true-returning' members will return false.
    • tryParseArgs

      protected Optional<Args> tryParseArgs()
    • accessesStdIn

      public boolean accessesStdIn()
      Description copied from interface: IProcessBuilderCore
      Whether the configured command will read from stdin. Used to avoid generation of needless named or anon pipes such as in "echo foo | echo bar": where the second link does not read the data from the prior link.
    • deriveInteractive

      protected boolean deriveInteractive(Args ar)
    • of

      public static ProcessBuilderDocker of(String... command)
    • of

      public static ProcessBuilderDocker of(List<String> command)
    • imageRef

      public String imageRef()
    • imageRef

      public ProcessBuilderDocker imageRef(String imageRef)
    • interactive

      public ProcessBuilderDocker interactive(Boolean interactive)
    • interactive

      public Boolean interactive()
    • commandParser

      public ProcessBuilderDocker commandParser(JvmCommandParser commandParser)
    • jvmCommandParser

      public JvmCommandParser jvmCommandParser()
    • fileMapper

      public FileMapper fileMapper()
      Set an explicit entrypoint. If none is set, an attempt to infer one from the context will be made upon starting the process.
      Parameters:
      entrypoint -
      Returns:
    • fileMapper

      public ProcessBuilderDocker fileMapper(FileMapper fileMapper)
    • workingDirectory

      public String workingDirectory()
    • workingDirectory

      public ProcessBuilderDocker workingDirectory(String workingDirectory)
    • compiler

      public ProcessBuilderDocker compiler(InvocationCompiler compiler)
    • compiler

      public InvocationCompiler compiler()
    • start

      public Process start(ProcessRunner executor) throws IOException
      Throws:
      IOException
    • catProcess

      protected static Process catProcess(Path source, Path target) throws IOException
      Throws:
      IOException
    • getUserString

      protected String getUserString() throws IOException
      Throws:
      IOException
    • toScriptString

      public static String toScriptString(CmdOp cmdOp)
    • setupContainer

      protected org.testcontainers.containers.GenericContainer<?> setupContainer(CmdOp rawCmdOp, FileMapper fileMapper) throws IOException
      Throws:
      IOException
    • extractSimpleCatPath

      public static String extractSimpleCatPath(CmdOp cmdOp)
      If the op is "/virt/cat path" then return path.
    • cloneActual

      protected ProcessBuilderDocker cloneActual()
      Specified by:
      cloneActual in class ProcessBuilderCore<ProcessBuilderDocker>
    • containerPathResolver

      protected ContainerPathResolver containerPathResolver()
    • containerPathResolver

      protected ProcessBuilderDocker containerPathResolver(ContainerPathResolver containerPathResolver)
    • applySettings

      protected void applySettings(ProcessBuilderDocker target)
    • toString

      public String toString()
      Overrides:
      toString in class Object