Created
December 16, 2021 12:27
A program that goes through all docker containers and outputs Java version in each container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Created for easy and efficient preliminary Log4J identification. Only identifies Java and its version.