In the previous recipe, we launched a container and executed a command inside the container using the /create, /attach, and /start API. In this recipe, we perform a few more operations on the container.
Performing container operations using APIs
How to do it...
In this recipe, we'll look at a few container operations:
- To list containers, use the following API:
Here are a few examples:
- Here is how to get all the running containers:
$ curl --unix-socket /var/run/docker.sock \ http:/containers/json
- Here is how to get all the running containers, including the stopped ones:
$ curl --unix-socket /var/run/docker.sock \ http:/containers/json?all=1
- To inspect a container, use the...