Created
February 21, 2019 14:21
-
-
Save shs96c/2cfd75d195f11f0392c9a51c44ea97cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DockerTest { | |
@Test | |
public void bootstrap() throws IOException { | |
HttpClient client = HttpClient.Factory.createDefault() | |
.createClient(new URL("http://localhost:2375")); | |
Docker docker = new Docker(client); | |
Image image = docker.findImage( | |
img -> "selenium/standalone-firefox:3.141.59".equals(img.getName())); | |
int port = PortProber.findFreePort(); | |
Container container = docker.create(ContainerInfo.image(image).map(tcp(4444), tcp(port))); | |
container.start(); | |
assertTrue(PortProber.pollPort(port, 10, SECONDS)); | |
container.stop(Duration.ofSeconds(30)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment