I am now using docker client api https://github.com/docker-java/docker-java in my Java project:
CreateContainerResponse container =
dockerClient
.createContainerCmd("ubuntu:java7")
.withCmd("true")
.exec();
dockerClient
.startContainerCmd(container.getId())
.exec();
When I start a new container using docker client api,the container is created,but i also finished.I use command "sudo docker ps" to list the running container now, what I created is not shown.I want to create the running container in my Java project using the docker client api,how should I do? Thanks.
docker ps -awill show you all containers, including the stopped ones.