Skip to content

Instantly share code, notes, and snippets.

@daman20
Created December 16, 2021 12:27
A program that goes through all docker containers and outputs Java version in each container
#!/bin/bash
# get all running docker container names
containers=$(sudo docker ps | awk '{if(NR>1) print $NF}')
host=$(hostname)
# loop through all containers
for container in $containers
do
echo $container
echo ;
javaVersion=$(docker exec $container java -version);
[ ! -z "$javaVersion" ] && echo "$javaVersion"
echo ;
echo ;
done
@daman20
Copy link
Author

daman20 commented Mar 1, 2022

Created for easy and efficient preliminary Log4J identification. Only identifies Java and its version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment