steampipe plugin install docker

Table: docker_compose_service - Query Docker Compose Services using SQL

Docker Compose is a tool for defining and managing multi-container Docker applications. It uses YAML files to configure application services and performs the creation and start-up process of all the containers with a single command. Docker Compose Services are the different services defined in the Docker Compose file, which can include settings like build, command, image, and volumes.

Table Usage Guide

The docker_compose_service table provides insights into Docker Compose Services within Docker. As a DevOps engineer, explore service-specific details through this table, including configuration, status, and associated metadata. Utilize it to uncover information about services, such as their current status, the Docker image they're using, and the commands they're running.

Examples

Basic info

Discover the segments that are using the maximum CPU resources in your Docker Compose service. This allows for efficient resource management and aids in identifying potential bottlenecks.

select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service;
select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service;

List CPU configurations of the services

Explore the CPU setup of your services to understand how they are configured and assess whether any adjustments are needed to optimize performance. This can provide valuable insights into potential bottlenecks and areas for improvement in your system.

select
name,
cpu_count,
cpu_percent,
cpu_period,
cpu_quota,
cpu_rt_period,
cpu_rt_runtime,
cpus,
cpu_shares
from
docker_compose_service;
select
name,
cpu_count,
cpu_percent,
cpu_period,
cpu_quota,
cpu_rt_period,
cpu_rt_runtime,
cpus,
cpu_shares
from
docker_compose_service;

List services running under default cgroup

Determine the areas in which Docker services are running under the default cgroup. This is useful for understanding resource allocation and identifying potential areas of optimization.

select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service
where
cgroup_parent is null;
select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service
where
cgroup_parent is null;

List services that do not have health check configured

Analyze the settings to understand which services are potentially vulnerable due to the absence of a configured health check. This can help in identifying areas that require immediate attention to ensure optimal system health and performance.

select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service
where
health_check is null;
select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service
where
health_check is null;

List services that do not have logging configured

Discover the segments that lack logging configurations to enhance system transparency and troubleshooting capabilities. This is beneficial in pinpointing areas for potential system improvement and ensuring optimal performance.

select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service
where
logging is null;
select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service
where
logging is null;

List services with privileged mode enabled for containers

Identify instances where services are running in privileged mode within Docker containers. This enables a comprehensive review of security practices, as running containers in privileged mode may expose them to potential risks.

select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service
where
privileged;
select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service
where
privileged = 1;

List services with READ ONLY mode enabled for containers

Explore services that have the READ ONLY mode enabled in their container settings. This can be useful to identify potential security measures or limitations within your Docker Compose services.

select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service
where
read_only;
select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service
where
read_only;

List services where user namespace is unused for containers

Discover the segments that consist of services where the user namespace remains unused for containers. This can be beneficial in identifying potential areas for optimization or troubleshooting in your Docker environment.

select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service
where
user_ns_mode is null;
select
name,
attach,
cgroup_parent,
cpu_count,
cpu_percent,
cpus
from
docker_compose_service
where
user_ns_mode is null;

Schema for docker_compose_service

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
annotationsjsonbAnnotations for the service.
attachbooleanSpecifies if containers should be attached to the terminal.
blkio_configjsonbBlock I/O (BLKIO) configuration for the service.
buildjsonbBuild configuration for the service.
cap_addjsonbList of capabilities to add to the container.
cap_dropjsonbList of capabilities to drop from the container.
cgrouptextCgroup rule to apply to the container.
cgroup_parenttextParent cgroup for the container.
commandtextCommand for the service containers.
configsjsonbList of configurations for the service.
container_nametextName of the container.
cpu_countbigintNumber of CPUs to allocate to the container.
cpu_percentdouble precisionCPU utilization limit as a percentage.
cpu_periodbigintCPU CFS (Completely Fair Scheduler) period.
cpu_quotabigintCPU CFS (Completely Fair Scheduler) quota.
cpu_rt_periodbigintCPU real-time period.
cpu_rt_runtimebigintCPU real-time runtime.
cpu_sharesbigintCPU shares (relative weight) for the container.
cpusdouble precisionNumber of CPUs to allocate to the container (in fractional form).
cpusettextCPUs in which to allow execution (comma-separated list or ranges).
credential_specjsonbCredential specification for the container.
custom_labelsjsonbCustom labels for the service.
depends_onjsonbDependencies for the service.
deployjsonbDeployment configuration for the service.
device_cgroup_rulesjsonbList of device cgroup rules for the container.
devicesjsonbList of devices to add to the container.
dnsjsonbList of DNS servers for the container.
dns_optsjsonbList of DNS options.
dns_searchjsonbList of DNS search domains.
dockerfiletextPath to the Dockerfile to use for the container.
domain_nametextDomain name of the container.
entrypointjsonbEntrypoint for the service containers.
env_filejsonbList of environment files to read.
environmentjsonbEnvironment variables for the container.
exposejsonbList of ports to expose from the container.
extendsjsonbConfiguration that the service extends.
extensionsjsonbExtensions for the service configuration.
external_linksjsonbList of external links to other services.
extra_hostsjsonbAdditional hostnames to resolve inside the container.
group_addjsonbList of additional groups for the container.
health_checkjsonbHealth check configuration for the service.
hostnametextHostname of the container.
imagetextDocker image for the container.
initbooleanSpecifies if the container should run as an init process.
ipctextIPC (Inter-Process Communication) mode for the container.
isolationtextIsolation technology used for the container.
labelsjsonbLabels for the service.
linksjsonbList of links to other services.
log_drivertextLogging driver for the container.
log_optjsonbOptions for the logging driver.
loggingjsonbLogging configuration for the service.
mac_addresstextMAC address for the container.
mem_limitbigintMemory limit for the container.
mem_reservationbigintMemory reservation for the container.
mem_swappinessbigintSwappiness value for the container.
memswap_limitbigintSwap limit for the container.
nametextName of the service.
nettextNetwork mode for the container.
network_modetextNetwork mode for the service.
networksjsonbNetwork configurations for the service.
oom_kill_disablebooleanSpecifies if OOM (Out-Of-Memory) killer is disabled.
oom_score_adjbigintOOM score adjustment for the container.
pidtextPID (Process ID) namespace for the container.
pids_limitbigintPIDS limit for the container.
platformtextPlatform to use for the container.
portsjsonbPorts to publish from the container.
privilegedbooleanSpecifies if the container should run in privileged mode.
profilesjsonbList of profiles associated with the service.
pull_policytextPull policy for the container image.
read_onlybooleanSpecifies if the container's root filesystem should be read-only.
restarttextRestart policy for the service.
runtimetextRuntime to use for the container.
scalebigintNumber of replicas to run for the service.
secretsjsonbSecrets configuration for the service.
security_optjsonbList of security options for the container.
shm_sizebigintSize of /dev/shm for the container.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
stdin_openbooleanSpecifies if stdin should be kept open for the container.
stop_grace_periodtextGrace period for the container to stop.
stop_signaltextSignal to stop the container.
sysctlsjsonbSysctls configuration for the container.
tmpfsjsonbList of tmpfs mounts for the container.
ttybooleanSpecifies if the container should allocate a pseudo-TTY.
ulimitsjsonbULimits (resource limits) for the container.
usertextUser to run commands inside the container.
user_ns_modetextUser namespace mode for the container.
utstextUTS namespace for the container.
volume_drivertextVolume driver to use for the container.
volumesjsonbVolumes to mount in the container.
volumes_fromjsonbList of volumes to mount from other containers.
working_dirtextWorking directory for commands inside the container.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- docker

You can pass the configuration to the command with the --config argument:

steampipe_export_docker --config '<your_config>' docker_compose_service