@Singleton public class DockerService extends Object
| Constructor and Description |
|---|
DockerService(org.apache.maven.project.MavenProject mavenProject) |
| Modifier and Type | Method and Description |
|---|---|
String |
buildImage(com.github.dockerjava.api.command.BuildImageCmd builder)
Builds the Docker image from the given
BuildImageCmd builder. |
com.github.dockerjava.api.command.BuildImageCmd |
buildImageCmd()
Creates a default
BuildImageCmd. |
com.github.dockerjava.api.command.BuildImageCmd |
buildImageCmd(String dockerfileName)
Creates the
BuildImageCmd by loading the given Dockerfile as classpath resource. |
File |
copyFromContainer(String imageId,
String containerPath)
Copies a file from the specified container path in the given image ID, into a temporal location.
|
File |
loadDockerfileAsResource(String name)
Loads the given Dockerfile as classpath resource and copies it into a temporary location in the target directory.
|
File |
loadDockerfileAsResource(String name,
String targetFileName)
Loads the given Dockerfile as classpath resource and copies it into a temporary location in the target directory.
|
com.github.dockerjava.api.command.PushImageCmd |
pushImageCmd(String imageName)
Creates a
PushImageCmd from the given image name. |
void |
runPrivilegedImageAndWait(String imageId,
Integer timeoutSeconds,
String checkpointNetworkName,
String... binds)
Creates a container based on a given image, and runs it.
|
@Inject public DockerService(org.apache.maven.project.MavenProject mavenProject)
public com.github.dockerjava.api.command.BuildImageCmd buildImageCmd(String dockerfileName) throws IOException
BuildImageCmd by loading the given Dockerfile as classpath resource.IOExceptionpublic com.github.dockerjava.api.command.BuildImageCmd buildImageCmd()
BuildImageCmd.public String buildImage(com.github.dockerjava.api.command.BuildImageCmd builder)
BuildImageCmd builder.public void runPrivilegedImageAndWait(String imageId, Integer timeoutSeconds, String checkpointNetworkName, String... binds) throws IOException
imageId - the image to usetimeoutSeconds - the timeout in seconds for the container to finish executionbinds - the bind mounts to useIOExceptionpublic File copyFromContainer(String imageId, String containerPath)
public File loadDockerfileAsResource(String name) throws IOException
IOExceptionpublic File loadDockerfileAsResource(String name, String targetFileName) throws IOException
IOExceptionpublic com.github.dockerjava.api.command.PushImageCmd pushImageCmd(String imageName)
PushImageCmd from the given image name.Copyright © 2020–2023 Micronaut. All rights reserved.