I am running a container with name tag which allows me to identify it.In docker-java,it requires container id for most of the operations and i do not know how to get that using docker-java.Can anyone help me how to get the container Id for the running container?
For example:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8945dcd6195b e7a064b1705a "java '-Duser.time..." 4 days ago Up 20 seconds runDataMock
I am looking for a way by which i could get the ContainerId using the ContainerNames.
NOTE: I am aware of the below method which creates a new container and picks the id. dockerClient.createContainerCmd(imageName).exec().getId()