Reputation: 3086
Ref: https://rominirani.com/docker-on-windows-mounting-host-directories-d96f3f056a2c
I want to manipulate my data by using docker image of gdal. The problem is I have to create a GUI wrapper in Java using Swing. How can run the docker command from Java ProcessBuilder? That is run the powershell commands from Java.
Upvotes: 0
Views: 439
Reputation: 1215
ProcessBuilder pb = new ProcessBuilder("ipconfig", "/all");
BufferedReader br = new BufferedReader(new InputStreamReader(pb.start().getInputStream()));
String str = "";
while ((str = br.readLine()) != null) {
System.out.println(str);
}
Replace "ipconfig", "/all" by your command (ex: "docker", "ps", "--all")
Upvotes: 2
Reputation: 33422
There are a plenty of Java wrappers around Docker API, like docker-java or docker-java-api. Pick one and you're good to go.
Upvotes: 3