Collect logs for containers only if docker runs

If no docker service runs on the host, but docker is installed,
docker stats command hangs forever. Prevent running all docker
commands if no docker service is running.

Change-Id: I697ed2bde251513ece0a25f7d2b51074f11e9c3e
This commit is contained in:
Sagi Shnaidman 2017-01-20 01:15:11 +02:00
parent e0c5a1d4aa
commit 87c92cd3fb
1 changed files with 1 additions and 1 deletions

View File

@ -137,7 +137,7 @@
- name: Collect docker info and logs
shell: >
if command -v docker; then
if command -v docker && systemctl is-active docker; then
All_FILE=/var/log/extra/docker_allinfo.log;
docker ps --all --size &> $All_FILE;
docker images &>> $All_FILE;