I am looking for method/way to perform the opertion like the below one
public String getContainerIdUsingName(String containerName) { try{ Process p = Runtime.getRuntime().exec("docker ps -aqf \"name="+containerName+"\""); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); return stdInput.readLine(); }catch (Exception exp){ exp.printStackTrace(); } return null; }
@RajAsapu you can use InspectContainer command. Please see InspectContainerCmdImplTest for example usage. Remember to pass the container name instead of id - they both can be used here as described in the docs.
Most helpful comment
@RajAsapu you can use
InspectContainercommand. Please see InspectContainerCmdImplTest for example usage. Remember to pass the container name instead of id - they both can be used here as described in the docs.