turbot/docker_compliance

Query: docker_container_restart_policy_on_failure

Usage

powerpipe query docker_compliance.query.docker_container_restart_policy_on_failure

Steampipe Tables

SQL

select
id as resource,
case
when inspect -> 'HostConfig' -> 'RestartPolicy' ->> 'Name' = 'on-failure'
and inspect -> 'HostConfig' -> 'RestartPolicy' ->> 'MaximumRetryCount' = '5' then 'ok'
else 'alarm'
end as status,
case
when inspect -> 'HostConfig' ->> 'ReadonlyRootfs' = 'false' then (names ->> 0) || ' RestartPolicy set to on-failure with MaximumRetryCount 5.'
else (names ->> 0) || ' RestartPolicy not set to on-failure with MaximumRetryCount 5.'
end as reason
, _ctx ->> 'connection_name' as connection_name
from
docker_container;

Controls

The query is being used by the following controls: