Releases: edwardUL99/DockerSandbox
Created new stable release with a new API
What's Changed
- 1.0.0 new interface by @edwardUL99 in #7
Full Changelog: 0.4.1...1.0.0
New API
The new API provides the previously static DockerSandbox class as an interface which allows multiple sandbox instantiations to be created independently. A builder can be used to build and configure an instance. The new API allows for a cleaner and simpler to use interface.
Fixed SLF4J Warning message
On startup of a Java program using this library, sometimes an SLF4J logger warning would appear saying there are double bindings on the classpath. This release removes that warning message
Added execution duration to Result
The execution duration of the docker container has now been added to the Result class. If it could not be determined, Double.NaN is used.
Removed working directory from Profiles
In earlier versions, working directory was present in a profile. But, a working directory was also passed into Docker#open which was used to create the WorkingDirectory object. However, this working directory path was ignored as the profile's working directory would be used. This led to unexpected behavior. The following changes has occurred in this release:
- Working directory has been removed from profiles and is instead retrieved from the call to Docker#open
- From this release, this library is published on Maven Central with the coordinates:
<groupId>io.github.edwardUL99</groupId>
<artifactId>docker-sandbox</artifactId>
<version>{VERSION_CODE}</version>
- Mountpoint has been removed from the WorkingDirectory class as the mount point does not need to be known
Added execution timeout
Execution timeout (in seconds) has been added. It is configured on a profile-by-profile basis. If execution exceeds the specified timeout, the container will return and a Result object with isTimedOut() true will be returned. This ensures there are no infinite loops that will indefinitely keep the container running and block the calling thread.
Initial Release
This is the initial release of the library. To see what the library provides, see the README.md file in this release. It is an experimental release as it is a library that I have completed in my free time.
I produced this library with inspiration from StepicOrg/epicbox for Python. I wanted to experiment with how to produce a similar library for use in Java and I have come up with a lightweight version (lightweight as it doesn't support as many features (especially with limits) as epicbox does).
Known Issues:
- If stdin is provided to a DockerSandbox.run call but the command provides doesn't use stdin, the calling thread gets blocked.
- The only limits available are CPU count and Memory. There is no timeout feature yet
- If the command continuously reads from stdin without terminating until a Ctrl-D character is received, the thread will also be blocked as the container won't terminate until that Ctrl-D is hit (relates to the timeout issue). The command
cat
without any arguments or - is a common one where this issue may occur, so if this command is received, a Ctrl-D character is added to the end of the stdin input