I want to make a script that assesses Docker
infrastructure and documents processes that are running there.
The first method I use is: docker inspect <container_id> | jq '.[].Args'
and grep processes from there (php-fpm
for example).
The second is: docker top <container_id> | awk '{$1=$2=$3=$4=$5=$6=$7=""; print $0}' | sed 's/^\s*//g'
Commands after pipeline help to build output for parsing.
What are other methods of obtaining information on Docker
infrastructure?
docker container inspect <container_id> -f docker container inspect uefibooter-http-1 -f '{{.State.Pid}}'
) and then look for processes that have the pid as their parent (and so forth recursively) (or use a tool likepstree
).