This image is based on progrium/consul it add java jdk and slang to the image.
I created this image to demonstrate the use of consul to monitor disk space of the docker machine and the use of slang to clear disk space if it needed. It integrates consul with CloudSlang to create a consul instance that automatically clears unused Docker images, once a certain DiskSpace health check fails.
To run the demo on the docker machine:
Create local folder consul.d
sudo mkdir consul.d
Add health check - json file consul.d/freespace.json
{"check": {"name": "freespace", "script": "sh /consul.d/AWS_Linux_FS_monitor.sh", "interval": "200s","timeout": "100s"}}
Add script to test the disk space consul.d/AWS_Linux_FS_monitor.sh
let usedthreshold=90 for free in 'df | grep -v -e "/boot" -e "/dev/shm" -e "Used" | awk '{print $5}' | cut -d"%" -f1' do if [ $free -ge $usedthreshold ] then echo $free exit 1 fi done echo 0 exit 0
slang run --f /slang-content/org/openscore/slang/docker/images/clear_docker_images_flow.sl --i docker_host=docker_host,docker_username=docker_username,docker_password=docker_password,private_key_file=/consul.d/xxxx.pem --cp /slang-content/org/openscore/slang/sudo docker run -p 8400:8400 -p 8500:8500 -p 8600:53/udp -v **PATHֹTOCONSUL.D/consul.d:/consul.d -h node1 gseffy/consul_cloudslang -server -bootstrap -ui-dir /ui -config-dir /consul.dGet container id
sudo docker ps
create watch
sudo docker exec container_id consul watch -type=checks -state=warning sh /consul.d/clearDiskSpace.sh watch checks[{"CheckID":"freespace"}]
Content type
Image
Digest
sha256:850e4ce06…
Size
180.1 MB
Last updated
almost 11 years ago
docker pull gseffy/consul_cloudslang