au.net.causal.maven.plugins.boxdb.db.DockerService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of boxdb-maven-plugin Show documentation
Show all versions of boxdb-maven-plugin Show documentation
Maven plugin to start databases using Docker and VMs
package au.net.causal.maven.plugins.boxdb.db;
import io.fabric8.maven.docker.service.ServiceHub;
import java.util.Objects;
/**
* Wrapper for interacting with the Docker service hub.
*/
public class DockerService
{
private final ServiceHub serviceHub;
private final String dockerHostAddress;
public DockerService(ServiceHub serviceHub, String dockerHostAddress)
{
Objects.requireNonNull(serviceHub, "serviceHub == null");
Objects.requireNonNull(dockerHostAddress, "dockerHostAddress == null");
this.serviceHub = serviceHub;
this.dockerHostAddress = dockerHostAddress;
}
/**
* The service hub provides a way for interacting with Docker.
*/
public ServiceHub getServiceHub()
{
return serviceHub;
}
/**
* Returns the network address of the docker 'machine'. For native Docker this will be localhost, but for systems
* that run Docker under a virtual machine, this may be the address of a VM in the system. Use this address
* for TCP connections to databases that are running in Docker machines.
*/
public String getDockerHostAddress()
{
return dockerHostAddress;
}
}