Interface DockerContainerService

    • Method Detail

      • run

        void run​(@NotNull
                 @NotNull ProcessContext processContext,
                 @NotNull
                 @NotNull Path dockerPath,
                 @NotNull
                 @NotNull String imageName,
                 @NotNull
                 @NotNull RunConfig runConfig,
                 @NotNull
                 @NotNull Path workingDirectory,
                 @NotNull
                 @NotNull Map<String,​String> environment)
          throws DockerException
        Start a Docker container for the image provided.
        Parameters:
        imageName - the image to run.
        runConfig - The run configuration describing which parameters to include for the Docker run command.
        Throws:
        DockerException
      • isRunning

        boolean isRunning​(@NotNull
                          @NotNull ProcessContext processContext,
                          @NotNull
                          @NotNull Path dockerPath,
                          @NotNull
                          @NotNull String containerName,
                          @NotNull
                          @NotNull Path workingDirectory,
                          @NotNull
                          @NotNull Map<String,​String> environment)
                   throws DockerException
        Checks if a container with the given name is running. If the container exists but has exited, this method will return false.
        Parameters:
        containerName - the name of the container to check.
        Returns:
        true if the container is running, false otherwise.
        Throws:
        DockerException
      • getHostPort

        @Nullable
        @Nullable Integer getHostPort​(@NotNull
                                      @NotNull ProcessContext processContext,
                                      @NotNull
                                      @NotNull Path dockerPath,
                                      @NotNull
                                      @NotNull String containerName,
                                      @NotNull
                                      @NotNull Integer containerPort,
                                      @NotNull
                                      @NotNull Path workingDirectory,
                                      @NotNull
                                      @NotNull Map<String,​String> environment)
                               throws DockerException
        Gets the host port mapped to the given container port.
        Parameters:
        containerName - the name of the container to check.
        containerPort - The container port.
        Returns:
        The host port or null if there is no host port mapped to the container port.
        Throws:
        DockerException
      • remove

        void remove​(@NotNull
                    @NotNull ProcessContext processContext,
                    @NotNull
                    @NotNull Path dockerPath,
                    @NotNull
                    @NotNull String containerName,
                    @NotNull
                    @NotNull Path workingDirectory,
                    @NotNull
                    @NotNull Map<String,​String> environment)
             throws DockerException
        Removes the container with the given name. This method will forcibly remove the container if it is running.
        Parameters:
        containerName - the name of the container to remove.
        Throws:
        DockerException