adam bien's blog

Listing Docker Containers with Nashorn 📎

Nashorn is a convenient REST-service client:

#!/usr/bin/jjs -fv
var host = "DOCKER_HOST"
var dockerUri="http://${host}:5555/containers/json";
var command = "curl ${dockerUri}";
$EXEC(command);
var containers = JSON.parse($OUT);
for each(container in containers){
	print("${container.Image} 	 ${container.Names[0]}	 ${container.Status}");
}

See also: https://github.com/AdamBien/watchdock

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting