public class Container extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
LOCALSTACK_EXTERNAL_HOSTNAME |
| Modifier and Type | Method and Description |
|---|---|
static Container |
createLocalstackContainer(String externalHostName,
boolean pullNewImage,
boolean randomizePorts,
String imageName,
String imageTag,
String portEdge,
String portElasticSearch,
Map<String,String> environmentVariables,
Map<Integer,Integer> portMappings,
Map<String,String> bindMounts,
String platform)
It creates a container using the hostname given and the set of environment variables provided
|
String |
executeCommand(List<String> command)
Run a command on the container via docker exec
|
int |
getExternalPortFor(int internalPort)
Given an internal port, retrieve the publicly addressable port that maps to it
|
static Container |
getRunningLocalstackContainer() |
static Container |
getRunningLocalstackContainer(String containerId) |
boolean |
isRunning() |
void |
stop()
Stop the container
|
void |
waitForAllPorts(String ip) |
void |
waitForLogToken(Pattern pattern)
Poll the docker logs until a specific token appears, then return.
|
public static final String LOCALSTACK_EXTERNAL_HOSTNAME
public static Container createLocalstackContainer(String externalHostName, boolean pullNewImage, boolean randomizePorts, String imageName, String imageTag, String portEdge, String portElasticSearch, Map<String,String> environmentVariables, Map<Integer,Integer> portMappings, Map<String,String> bindMounts, String platform)
externalHostName - hostname to be used by localstackpullNewImage - determines if docker pull should be run to update to the latest image of the containerrandomizePorts - determines if the container should expose the default local stack ports or if it should expose randomized ports
in order to prevent conflicts with other localstack containers running on the same machineimageName - the name of the image defaults to if nullimageTag - the tag of the image to pull, defaults to if nullenvironmentVariables - map of environment variables to be passed to the docker containerportMappings - bindMounts - Docker host to container volume mapping like /host/dir:/container/dir, be aware that the host
directory must be an absolute pathplatform - target platform for the localstack docker imagepublic static Container getRunningLocalstackContainer()
public static Container getRunningLocalstackContainer(String containerId)
public int getExternalPortFor(int internalPort)
public void waitForAllPorts(String ip)
public boolean isRunning()
public void waitForLogToken(Pattern pattern)
public void stop()
Copyright © 2023. All rights reserved.