Docker is a very important and exciting tool, at the most basic level , it runs containers from pre-built images. Usually, you would need to see a list of the running containers and this can be done easily using the command below
$ docker ps
This will give an output similar to this
Also, you can get this formatted as json by using the command below
$ docker ps --format="{{ json . }}"
The problem with the output above is that the json isn’t fully valid to be used in another application, to resolve this issue, we can query the data from the Docker Engine Api using the command below
$ curl -s --unix-socket /var/run/docker.sock http://localhost/containers/json
You get an output similar to this
The output above is a very valid json document and this can even be made pretty by using a tool such as jq, as follows