turbot/docker_compliance

Query: exec_separate_partition_for_containers_created

Usage

powerpipe query docker_compliance.query.exec_separate_partition_for_containers_created

Steampipe Tables

SQL

with os_output as (
select
btrim(stdout_output, E' \n\r\t') as os,
_ctx ->> 'connection_name' as os_conn
from
exec_command
where
command = 'uname -s'
), hostname as (
select
btrim(stdout_output, E' \n\r\t') as host,
_ctx ->> 'connection_name' as host_conn,
_ctx
from
exec_command
where
command = 'hostname'
),
linux_output as (
select
stdout_output,
_ctx ->> 'connection_name' as conn
from
exec_command,
os_output
where
os_conn = _ctx ->> 'connection_name'
and os_output.os = 'Linux'
and command = E'mountpoint -- "$(docker info -f \'{{ .DockerRootDir }}\')"'
),
darwin_output as (
select
stdout_output,
_ctx ->> 'connection_name' as conn
from
exec_command,
os_output
where
os_conn = _ctx ->> 'connection_name'
and os_output.os = 'Darwin'
and command = E'df | grep "$(docker info -f \'{{ .DockerRootDir }}\')"'
),
command_output as (
select * from darwin_output
union all
select * from linux_output
)
select
host as resource,
case
when o.stdout_output = '' or o.stdout_output like '%not a mountpoint%' then 'alarm'
else 'ok'
end as status,
case
when o.stdout_output = '' or o.stdout_output like '%not a mountpoint%' then host || ' configured Docker root directory is not a mount point.'
else host || ' configured Docker root directory is a mount point.'
end as reason
, h._ctx ->> 'connection_name' as connection_name
from
hostname as h,
linux_output as o
where
o.conn = h.host_conn;

Controls

The query is being used by the following controls: