Core concepts
Executing commands
By default the container will execute whatever command is specified in the image's Dockerfile. To override this, and specify a different command, use
withCommand. For example:Container startup command
By default the container will execute whatever command is specified in the image's Dockerfile. To override this, and specify a different command, use withCommand. For example:
Specifying a startup command inside_block:startupCommand
Executing a command
Your test can execute a command inside a running container, similar to a docker exec call:
Executing a command inside a running container inside_block:standaloneExec
This can be useful for software that has a command line administration tool. You can also get the output (stdout/stderr) and exit code from the command - for example:
Executing a command inside a running container and reading the result inside_block:execReadingStdout
Environment variables
To add environment variables to the container, use withEnv:
new GenericContainer(...)
.withEnv("API_TOKEN", "foo")