clibdocker  0.1.0-alpha.0
A Docker API for C
Macros | Typedefs | Functions
docker_system.h File Reference

Docker System API. More...

#include "docker_all.h"
#include <json-c/json_object.h>
Include dependency graph for docker_system.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define free_docker_version(version)   json_object_put((json_object*) version)
 Free the docker version object.
 
#define docker_version_version_get(version)   get_attr_str((json_object*)version, "Version")
 Get the docker version string from the docker version object. More...
 
#define docker_version_os_get(version)   get_attr_str((json_object*)version, "Os")
 Get the operating system of the docker server from the docker version object. More...
 
#define docker_version_kernel_version_get(version)   get_attr_str((json_object*)version, "KernelVersion")
 Get the kernel version string from the docker version object. More...
 
#define docker_version_go_version_get(version)   get_attr_str((json_object*)version, "GoVersion")
 Get the golang version string from the docker version object. More...
 
#define docker_version_git_commit_get(version)   get_attr_str((json_object*)version, "GitCommit")
 Get the git commit id from the docker version object. More...
 
#define docker_version_arch_get(version)   get_attr_str((json_object*)version, "Arch")
 Get the architecture of the docker server machine from the docker version object. More...
 
#define docker_version_api_version_get(version)   get_attr_str((json_object*)version, "ApiVersion")
 Get the api version of the docker server from the docker version object. More...
 
#define docker_version_min_api_version_get(version)   get_attr_str((json_object*)version, "MinAPIVersion")
 Get the minimum api version supported by the docker server from the docker version object. More...
 
#define docker_version_build_time_get(version)   get_attr_str((json_object*)version, "BuildTime")
 Get the build time of the docker server from the docker version object. More...
 
#define docker_version_experimental_get(version)   get_attr_boolean((json_object*)version, "Experimental")
 Get the flag indicating if the docker is running in experimental mode from the docker version object. More...
 
#define free_docker_info(info)   json_object_put((json_object*) info)
 Free the docker info object.
 
#define docker_info_containers_get(info)   get_attr_unsigned_long((json_object*)info, "Containers")
 Get the containers count from the docker info. More...
 
#define docker_info_containers_running_get(info)   get_attr_unsigned_long((json_object*)info, "ContainersRunning")
 Get the running containers count from the docker info. More...
 
#define docker_info_containers_paused_get(info)   get_attr_unsigned_long((json_object*)info, "ContainersPaused")
 Get the paused containers count from the docker info. More...
 
#define docker_info_containers_stopped_get(info)   get_attr_unsigned_long((json_object*)info, "ContainersStopped")
 Get the stopped containers count from the docker info. More...
 
#define docker_info_images_get(info)   get_attr_unsigned_long((json_object*)info, "Images")
 Get the images count from the docker info. More...
 
#define docker_info_name_get(info)   get_attr_str((json_object*)info, "Name")
 Get the docker server name from the docker info. More...
 
#define docker_info_ncpu_get(info)   get_attr_int((json_object*)info, "NCPU")
 Get the docker server CPU count from the docker info. More...
 
#define docker_info_mem_total_get(info)   get_attr_unsigned_long((json_object*)info, "MemTotal")
 Get the docker server total memory from the docker info. More...
 
#define free_docker_event_list(event_ls)   arraylist_free(event_ls)
 Free the docker event list object. More...
 
#define docker_event_list_length(event_ls)   arraylist_length(event_ls)
 Length of docker event list. More...
 
#define docker_event_list_get_idx(event_ls, i)   arraylist_get(event_ls, i)
 Get the ith event from the docker event list. More...
 
#define free_docker_event(event)   json_object_put((json_object*) event)
 Free the docker event json object. More...
 
#define docker_event_type_get(event)   get_attr_str((json_object*)event, "Type")
 Get the event type string from the docker event object. More...
 
#define docker_event_action_get(event)   get_attr_str((json_object*)event, "Action")
 Get the action from the docker event object. More...
 
#define docker_event_time_get(event)   get_attr_unsigned_long((json_object*)event, "time")
 Get the event time from the docker event object. More...
 
#define docker_event_actor_id_get(event)   get_attr_str(get_attr_json_object((json_object*)event, "Actor"), "ID")
 Get the actor id from the docker event object. More...
 
#define docker_event_attributes_get(event)   get_attr_json_object(get_attr_json_object((json_object*)event, "Actor"), "Attributes")
 Get the actor attributes from the docker event object. More...
 
#define docker_event_attributes_foreach(event)   json_object_object_foreach(docker_event_attributes_get(event), key, val)
 Iterate over the key/val pair of each attribute in the docker event attributes object. More...
 
#define docker_df_image_id_get(img)   get_attr_str((json_object*)img, "Id")
 Get the image id from the docker df image object. More...
 
#define docker_df_image_parent_id_get(img)   get_attr_str((json_object*)img, "ParentId")
 Get the parent image id from the docker df image object. More...
 
#define docker_df_image_created_get(img)   get_attr_unsigned_long((json_object*)img, "Created")
 Get the image creation datetime from the docker df image object. More...
 
#define docker_df_image_size_get(img)   get_attr_unsigned_long((json_object*)img, "Size")
 Get the image size from the docker df image object. More...
 
#define docker_df_image_shared_size_get(img)   get_attr_unsigned_long((json_object*)img, "SharedSize")
 Get the image shared size from the docker df image object. More...
 
#define docker_df_image_virtual_size_get(img)   get_attr_unsigned_long((json_object*)img, "VirtualSize")
 Get the image virtual size from the docker df image object. More...
 
#define docker_df_image_containers_get(img)   get_attr_unsigned_long((json_object*)img, "Containers")
 Get the image containers count from the docker df image object. More...
 
#define docker_df_image_repo_tags_get(img)   get_attr_json_object((json_object*)img, "RepoTags")
 Get the image repo tags list from the docker df image object. More...
 
#define docker_df_image_repo_tags_length(img)   json_object_array_length(docker_df_image_repo_tags_get(img))
 Get the image repo tags list length from the docker df image object. More...
 
#define docker_df_image_repo_tags_get_idx(img, i)   (const char*)json_object_array_get_idx(docker_df_image_repo_tags_get(img), i)
 Get the ith repo tag from the repo tags list of the docker df image object. More...
 
#define docker_df_image_repo_digests_get(img)   get_attr_json_object((json_object*)img, "RepoDigests")
 Get the image repo digests list from the docker df image object. More...
 
#define docker_df_image_repo_digests_length(img)   json_object_array_length(docker_df_image_repo_digests_get(img))
 Get the image repo digests list length from the docker df image object. More...
 
#define docker_df_image_repo_digests_get_idx(img, i)   (const char*)json_object_array_get_idx(docker_df_image_repo_digests_get(img), i)
 Get the ith repo digest from the repo digests list of the docker df image object. More...
 
#define docker_df_container_id_get(ctr)   get_attr_str((json_object*)ctr, "Id")
 Get the container id from the docker df container object. More...
 
#define docker_df_container_image_get(ctr)   get_attr_str((json_object*)ctr, "Image")
 Get the container image name from the docker df container object. More...
 
#define docker_df_container_image_id_get(ctr)   get_attr_str((json_object*)ctr, "ImageID")
 Get the container image id from the docker df container object. More...
 
#define docker_df_container_command_get(ctr)   get_attr_str((json_object*)ctr, "Command")
 Get the container command from the docker df container object. More...
 
#define docker_df_container_created_get(ctr)   get_attr_unsigned_long((json_object*)ctr, "Created")
 Get the created time from the docker df container object. More...
 
#define docker_df_container_size_rootfs_get(ctr)   get_attr_unsigned_long((json_object*)ctr, "SizeRootFs")
 Get the container rootfs size from the docker df container object. More...
 
#define docker_df_container_state_get(ctr)   get_attr_str((json_object*)ctr, "State")
 Get the container state from the docker df container object. More...
 
#define docker_df_container_status_get(ctr)   get_attr_str((json_object*)ctr, "Status")
 Get the container status from the docker df container object. More...
 
#define docker_df_volume_name_get(vol)   get_attr_str((json_object*)vol, "Name")
 Get the volume name from the docker df volume object. More...
 
#define docker_df_volume_driver_get(vol)   get_attr_str((json_object*)vol, "Driver")
 Get the volume driver from the docker df volume object. More...
 
#define docker_df_volume_mountpoint_get(vol)   get_attr_str((json_object*)vol, "Mountpoint")
 Get the volume mountpoint from the docker df volume object. More...
 
#define docker_df_volume_scope_get(vol)   get_attr_str((json_object*)vol, "Scope")
 Get the volume scope from the docker df volume object. More...
 
#define docker_df_volume_usage_data_get(vol)   (docker_df_volume_usage_data*)get_attr_json_object((json_object*)vol, "UsageData")
 Get the volume usage from the docker df volume object. More...
 
#define docker_df_volume_usage_data_size_get(ud)   get_attr_unsigned_long((json_object*)ud, "Size")
 Get the volume size from the docker df volume object. More...
 
#define docker_df_volume_usage_data_ref_count_get(ud)   get_attr_unsigned_long((json_object*)ud, "RefCount")
 Get the volume reference count from the docker df volume object. More...
 
#define docker_df_container_names_get(ctr)   get_attr_json_object((json_object*)ctr, "Names")
 Get the container names list from the docker df container object. More...
 
#define docker_df_container_names_length(ctr)   json_object_array_length(docker_df_container_names_get(ctr))
 Get the container names list length from the docker df container object. More...
 
#define docker_df_container_names_get_idx(ctr, i)   (const char*)json_object_array_get_idx(docker_df_container_names_get(ctr), i)
 Get the ith name from the container names list from the docker df container object. More...
 
#define docker_df_container_mounts_get(ctr)   get_attr_json_object((json_object*)ctr, "Mounts")
 Get the mounts list from the docker df container object. More...
 
#define docker_df_container_mounts_length(ctr)   json_object_array_length(docker_df_container_mounts_get(ctr))
 Get the container mounts list length from the docker df container object. More...
 
#define docker_df_container_mounts_get_idx(ctr, i)   (const char*)json_object_array_get_idx(docker_df_container_mounts_get(ctr), i)
 Get the ith mount from the container mounts list from the docker df container object. More...
 
#define free_docker_df(df)   json_object_put((json_object*) df)
 Free the docker df json object. More...
 
#define docker_df_layers_size_get(df)   get_attr_unsigned_long((json_object*)df, "LayersSize")
 Get the layers size from the docker df json object. More...
 
#define docker_df_images_get(df)   get_attr_json_object((json_object*)df, "Images")
 Get the docker images list from the docker df json object. More...
 
#define docker_df_images_length(df)   json_object_array_length(docker_df_images_get(df))
 Get the docker images list length from the docker df json object. More...
 
#define docker_df_images_get_idx(df, i)   (docker_df_image*)json_object_array_get_idx(docker_df_images_get(df), i)
 Get the ith docker image from the docker df json object. More...
 
#define docker_df_containers_get(df)   get_attr_json_object((json_object*)df, "Containers")
 Get the docker containers list from the docker df json object. More...
 
#define docker_df_containers_length(df)   json_object_array_length(docker_df_containers_get(df))
 Get the docker containers list length from the docker df json object. More...
 
#define docker_df_containers_get_idx(df, i)   (docker_df_container*)json_object_array_get_idx(docker_df_containers_get(df), i)
 Get the ith docker container from the docker df json object. More...
 
#define docker_df_volumes_get(df)   get_attr_json_object((json_object*)df, "Volumes")
 Get the docker volumes list from the docker df json object. More...
 
#define docker_df_volumes_length(df)   json_object_array_length(docker_df_volumes_get(df))
 Get the docker volumes list length from the docker df json object. More...
 
#define docker_df_volumes_get_idx(df, i)   (docker_df_volume*)json_object_array_get_idx(docker_df_volumes_get(df), i)
 Get the ith docker volume from the docker df json object. More...
 

Typedefs

typedef json_object docker_version
 Docker Version json object. More...
 
typedef json_object docker_info
 Docker Info json object. This object represents the response returned from a docker system info call. More...
 
typedef arraylist docker_event_list
 Docker Event List json object.
 
typedef json_object docker_event
 Docker Event json object.
 
typedef json_object docker_df
 Docker disk usage (df) json object. More...
 
typedef json_object docker_df_image
 Docker image disk usage (image df) json object.
 
typedef json_object docker_df_container
 Docker container disk usage (container df) json object.
 
typedef json_object docker_df_volume
 Docker volume disk usage (volume df) json object.
 
typedef json_object docker_df_volume_usage_data
 Docker volume usage (volume usage df) json object.
 

Functions

d_err_t docker_ping (docker_context *ctx)
 Ping the docker server. Returns E_SUCCESS(0) if the server is reachable. More...
 
d_err_t docker_system_version (docker_context *ctx, docker_version **version)
 
d_err_t docker_system_info (docker_context *ctx, docker_info **info)
 
d_err_t docker_system_events (docker_context *ctx, arraylist **events, time_t start_time, time_t end_time)
 
d_err_t docker_system_events_cb (docker_context *ctx, void(*docker_events_cb)(docker_event *evt, void *cbargs), void *cbargs, arraylist **events, time_t start_time, time_t end_time)
 
d_err_t docker_system_df (docker_context *ctx, docker_df **df)
 

Detailed Description

Docker System API.

Macro Definition Documentation

◆ docker_df_container_command_get

#define docker_df_container_command_get (   ctr)    get_attr_str((json_object*)ctr, "Command")

Get the container command from the docker df container object.

Parameters
ctrdocker df container object
Returns
char* container command

◆ docker_df_container_created_get

#define docker_df_container_created_get (   ctr)    get_attr_unsigned_long((json_object*)ctr, "Created")

Get the created time from the docker df container object.

Parameters
ctrdocker df container object
Returns
unsigned long created time

◆ docker_df_container_id_get

#define docker_df_container_id_get (   ctr)    get_attr_str((json_object*)ctr, "Id")

Get the container id from the docker df container object.

Parameters
ctrdocker df container object
Returns
char* container id

◆ docker_df_container_image_get

#define docker_df_container_image_get (   ctr)    get_attr_str((json_object*)ctr, "Image")

Get the container image name from the docker df container object.

Parameters
ctrdocker df container object
Returns
char* container image name

◆ docker_df_container_image_id_get

#define docker_df_container_image_id_get (   ctr)    get_attr_str((json_object*)ctr, "ImageID")

Get the container image id from the docker df container object.

Parameters
ctrdocker df container object
Returns
char* container image id

◆ docker_df_container_mounts_get

#define docker_df_container_mounts_get (   ctr)    get_attr_json_object((json_object*)ctr, "Mounts")

Get the mounts list from the docker df container object.

Parameters
ctrdocker df container object
Returns
json_object* mounts list

◆ docker_df_container_mounts_get_idx

#define docker_df_container_mounts_get_idx (   ctr,
 
)    (const char*)json_object_array_get_idx(docker_df_container_mounts_get(ctr), i)

Get the ith mount from the container mounts list from the docker df container object.

Parameters
ctrdocker df container object
iindex
Returns
char* ith mount from container mounts list

◆ docker_df_container_mounts_length

#define docker_df_container_mounts_length (   ctr)    json_object_array_length(docker_df_container_mounts_get(ctr))

Get the container mounts list length from the docker df container object.

Parameters
ctrdocker df container object
Returns
size_t mounts list length

◆ docker_df_container_names_get

#define docker_df_container_names_get (   ctr)    get_attr_json_object((json_object*)ctr, "Names")

Get the container names list from the docker df container object.

Parameters
ctrdocker df container object
Returns
char* container names list

◆ docker_df_container_names_get_idx

#define docker_df_container_names_get_idx (   ctr,
 
)    (const char*)json_object_array_get_idx(docker_df_container_names_get(ctr), i)

Get the ith name from the container names list from the docker df container object.

Parameters
ctrdocker df container object
iindex
Returns
char* ith name from container names list

◆ docker_df_container_names_length

#define docker_df_container_names_length (   ctr)    json_object_array_length(docker_df_container_names_get(ctr))

Get the container names list length from the docker df container object.

Parameters
ctrdocker df container object
Returns
size_t container names list length

◆ docker_df_container_size_rootfs_get

#define docker_df_container_size_rootfs_get (   ctr)    get_attr_unsigned_long((json_object*)ctr, "SizeRootFs")

Get the container rootfs size from the docker df container object.

Parameters
ctrdocker df container object
Returns
unsigned long container rootfs size

◆ docker_df_container_state_get

#define docker_df_container_state_get (   ctr)    get_attr_str((json_object*)ctr, "State")

Get the container state from the docker df container object.

Parameters
ctrdocker df container object
Returns
char* container state

◆ docker_df_container_status_get

#define docker_df_container_status_get (   ctr)    get_attr_str((json_object*)ctr, "Status")

Get the container status from the docker df container object.

Parameters
ctrdocker df container object
Returns
char* container status

◆ docker_df_containers_get

#define docker_df_containers_get (   df)    get_attr_json_object((json_object*)df, "Containers")

Get the docker containers list from the docker df json object.

Parameters
dfdocker df json object
Returns
json_object* docker containers list

◆ docker_df_containers_get_idx

#define docker_df_containers_get_idx (   df,
 
)    (docker_df_container*)json_object_array_get_idx(docker_df_containers_get(df), i)

Get the ith docker container from the docker df json object.

Parameters
dfdocker df json object
iindex
Returns
docker_df_container* ith docker container

◆ docker_df_containers_length

#define docker_df_containers_length (   df)    json_object_array_length(docker_df_containers_get(df))

Get the docker containers list length from the docker df json object.

Parameters
dfdocker df json object
Returns
size_t docker containers list length

◆ docker_df_image_containers_get

#define docker_df_image_containers_get (   img)    get_attr_unsigned_long((json_object*)img, "Containers")

Get the image containers count from the docker df image object.

Parameters
imgdocker df image object
Returns
unsigned long image containers count

◆ docker_df_image_created_get

#define docker_df_image_created_get (   img)    get_attr_unsigned_long((json_object*)img, "Created")

Get the image creation datetime from the docker df image object.

Parameters
imgdocker df image object
Returns
unsigned long image creation datetime

◆ docker_df_image_id_get

#define docker_df_image_id_get (   img)    get_attr_str((json_object*)img, "Id")

Get the image id from the docker df image object.

Parameters
imgdocker df image object
Returns
char* image id

◆ docker_df_image_parent_id_get

#define docker_df_image_parent_id_get (   img)    get_attr_str((json_object*)img, "ParentId")

Get the parent image id from the docker df image object.

Parameters
imgdocker df image object
Returns
char* parent image id

◆ docker_df_image_repo_digests_get

#define docker_df_image_repo_digests_get (   img)    get_attr_json_object((json_object*)img, "RepoDigests")

Get the image repo digests list from the docker df image object.

Parameters
imgdocker df image object
Returns
json_object* repo digests list

◆ docker_df_image_repo_digests_get_idx

#define docker_df_image_repo_digests_get_idx (   img,
 
)    (const char*)json_object_array_get_idx(docker_df_image_repo_digests_get(img), i)

Get the ith repo digest from the repo digests list of the docker df image object.

Parameters
imgdocker df image object
iindex
Returns
char* ith image repo digest

◆ docker_df_image_repo_digests_length

#define docker_df_image_repo_digests_length (   img)    json_object_array_length(docker_df_image_repo_digests_get(img))

Get the image repo digests list length from the docker df image object.

Parameters
imgdocker df image object
Returns
size_t length of repo digests list

◆ docker_df_image_repo_tags_get

#define docker_df_image_repo_tags_get (   img)    get_attr_json_object((json_object*)img, "RepoTags")

Get the image repo tags list from the docker df image object.

Parameters
imgdocker df image object
Returns
json_object* repo tags list

◆ docker_df_image_repo_tags_get_idx

#define docker_df_image_repo_tags_get_idx (   img,
 
)    (const char*)json_object_array_get_idx(docker_df_image_repo_tags_get(img), i)

Get the ith repo tag from the repo tags list of the docker df image object.

Parameters
imgdocker df image object
iindex
Returns
char* ith image repo tag

◆ docker_df_image_repo_tags_length

#define docker_df_image_repo_tags_length (   img)    json_object_array_length(docker_df_image_repo_tags_get(img))

Get the image repo tags list length from the docker df image object.

Parameters
imgdocker df image object
Returns
size_t length of repo tags list

◆ docker_df_image_shared_size_get

#define docker_df_image_shared_size_get (   img)    get_attr_unsigned_long((json_object*)img, "SharedSize")

Get the image shared size from the docker df image object.

Parameters
imgdocker df image object
Returns
unsigned long image shared size

◆ docker_df_image_size_get

#define docker_df_image_size_get (   img)    get_attr_unsigned_long((json_object*)img, "Size")

Get the image size from the docker df image object.

Parameters
imgdocker df image object
Returns
unsigned long image size

◆ docker_df_image_virtual_size_get

#define docker_df_image_virtual_size_get (   img)    get_attr_unsigned_long((json_object*)img, "VirtualSize")

Get the image virtual size from the docker df image object.

Parameters
imgdocker df image object
Returns
unsigned long image virtual size

◆ docker_df_images_get

#define docker_df_images_get (   df)    get_attr_json_object((json_object*)df, "Images")

Get the docker images list from the docker df json object.

Parameters
dfdocker df json object
Returns
json_object* docker images list

◆ docker_df_images_get_idx

#define docker_df_images_get_idx (   df,
 
)    (docker_df_image*)json_object_array_get_idx(docker_df_images_get(df), i)

Get the ith docker image from the docker df json object.

Parameters
dfdocker df json object
iindex
Returns
docker_df_image* ith docker image

◆ docker_df_images_length

#define docker_df_images_length (   df)    json_object_array_length(docker_df_images_get(df))

Get the docker images list length from the docker df json object.

Parameters
dfdocker df json object
Returns
size_t docker images list length

◆ docker_df_layers_size_get

#define docker_df_layers_size_get (   df)    get_attr_unsigned_long((json_object*)df, "LayersSize")

Get the layers size from the docker df json object.

Parameters
dfdocker df json object
Returns
unsigned long layers size

◆ docker_df_volume_driver_get

#define docker_df_volume_driver_get (   vol)    get_attr_str((json_object*)vol, "Driver")

Get the volume driver from the docker df volume object.

Parameters
voldocker df volume object
Returns
char* volume driver

◆ docker_df_volume_mountpoint_get

#define docker_df_volume_mountpoint_get (   vol)    get_attr_str((json_object*)vol, "Mountpoint")

Get the volume mountpoint from the docker df volume object.

Parameters
voldocker df volume object
Returns
char* volume mountpoint

◆ docker_df_volume_name_get

#define docker_df_volume_name_get (   vol)    get_attr_str((json_object*)vol, "Name")

Get the volume name from the docker df volume object.

Parameters
voldocker df volume object
Returns
char* volume name

◆ docker_df_volume_scope_get

#define docker_df_volume_scope_get (   vol)    get_attr_str((json_object*)vol, "Scope")

Get the volume scope from the docker df volume object.

Parameters
voldocker df volume object
Returns
char* volume scope

◆ docker_df_volume_usage_data_get

#define docker_df_volume_usage_data_get (   vol)    (docker_df_volume_usage_data*)get_attr_json_object((json_object*)vol, "UsageData")

Get the volume usage from the docker df volume object.

Parameters
voldocker df volume object
Returns
json_object* volume usage data

◆ docker_df_volume_usage_data_ref_count_get

#define docker_df_volume_usage_data_ref_count_get (   ud)    get_attr_unsigned_long((json_object*)ud, "RefCount")

Get the volume reference count from the docker df volume object.

Parameters
uddocker df volume object
Returns
unsigned long volume reference count

◆ docker_df_volume_usage_data_size_get

#define docker_df_volume_usage_data_size_get (   ud)    get_attr_unsigned_long((json_object*)ud, "Size")

Get the volume size from the docker df volume object.

Parameters
uddocker df volume object
Returns
unsigned long volume size

◆ docker_df_volumes_get

#define docker_df_volumes_get (   df)    get_attr_json_object((json_object*)df, "Volumes")

Get the docker volumes list from the docker df json object.

Parameters
dfdocker df json object
Returns
json_object* docker volumes list

◆ docker_df_volumes_get_idx

#define docker_df_volumes_get_idx (   df,
 
)    (docker_df_volume*)json_object_array_get_idx(docker_df_volumes_get(df), i)

Get the ith docker volume from the docker df json object.

Parameters
dfdocker df json object
iindex
Returns
docker_df_volume* ith docker volume

◆ docker_df_volumes_length

#define docker_df_volumes_length (   df)    json_object_array_length(docker_df_volumes_get(df))

Get the docker volumes list length from the docker df json object.

Parameters
dfdocker df json object
Returns
size_t docker volumes list length

◆ docker_event_action_get

#define docker_event_action_get (   event)    get_attr_str((json_object*)event, "Action")

Get the action from the docker event object.

Parameters
eventdocker event object
Returns
char* action

◆ docker_event_actor_id_get

#define docker_event_actor_id_get (   event)    get_attr_str(get_attr_json_object((json_object*)event, "Actor"), "ID")

Get the actor id from the docker event object.

Parameters
eventdocker event object
Returns
char* actor id

◆ docker_event_attributes_foreach

#define docker_event_attributes_foreach (   event)    json_object_object_foreach(docker_event_attributes_get(event), key, val)

Iterate over the key/val pair of each attribute in the docker event attributes object.

Parameters
eventdocker event object

◆ docker_event_attributes_get

#define docker_event_attributes_get (   event)    get_attr_json_object(get_attr_json_object((json_object*)event, "Actor"), "Attributes")

Get the actor attributes from the docker event object.

Parameters
eventdocker event object
Returns
json_object* actor attributes

◆ docker_event_list_get_idx

#define docker_event_list_get_idx (   event_ls,
 
)    arraylist_get(event_ls, i)

Get the ith event from the docker event list.

Parameters
event_lsdocker event list
iindex
Returns
docker_event* ith event in the list

◆ docker_event_list_length

#define docker_event_list_length (   event_ls)    arraylist_length(event_ls)

Length of docker event list.

Parameters
event_lsdocker event list
Returns
size_t length of the events list

◆ docker_event_time_get

#define docker_event_time_get (   event)    get_attr_unsigned_long((json_object*)event, "time")

Get the event time from the docker event object.

Parameters
eventdocker event object
Returns
unsigned long event time

◆ docker_event_type_get

#define docker_event_type_get (   event)    get_attr_str((json_object*)event, "Type")

Get the event type string from the docker event object.

Parameters
eventdocker event object
Returns
char* event type

◆ docker_info_containers_get

#define docker_info_containers_get (   info)    get_attr_unsigned_long((json_object*)info, "Containers")

Get the containers count from the docker info.

Parameters
infodocker info object
Returns
unsigned long containers count

◆ docker_info_containers_paused_get

#define docker_info_containers_paused_get (   info)    get_attr_unsigned_long((json_object*)info, "ContainersPaused")

Get the paused containers count from the docker info.

Parameters
infodocker info object
Returns
unsigned long paused containers count

◆ docker_info_containers_running_get

#define docker_info_containers_running_get (   info)    get_attr_unsigned_long((json_object*)info, "ContainersRunning")

Get the running containers count from the docker info.

Parameters
infodocker info object
Returns
unsigned long running containers count

◆ docker_info_containers_stopped_get

#define docker_info_containers_stopped_get (   info)    get_attr_unsigned_long((json_object*)info, "ContainersStopped")

Get the stopped containers count from the docker info.

Parameters
infodocker info object
Returns
unsigned long stopped containers count

◆ docker_info_images_get

#define docker_info_images_get (   info)    get_attr_unsigned_long((json_object*)info, "Images")

Get the images count from the docker info.

Parameters
infodocker info object
Returns
unsigned long images count

◆ docker_info_mem_total_get

#define docker_info_mem_total_get (   info)    get_attr_unsigned_long((json_object*)info, "MemTotal")

Get the docker server total memory from the docker info.

Parameters
infodocker info object
Returns
unsigned long total docker server memory

◆ docker_info_name_get

#define docker_info_name_get (   info)    get_attr_str((json_object*)info, "Name")

Get the docker server name from the docker info.

Parameters
infodocker info object
Returns
char* docker server name

◆ docker_info_ncpu_get

#define docker_info_ncpu_get (   info)    get_attr_int((json_object*)info, "NCPU")

Get the docker server CPU count from the docker info.

Parameters
infodocker info object
Returns
int CPU count

◆ docker_version_api_version_get

#define docker_version_api_version_get (   version)    get_attr_str((json_object*)version, "ApiVersion")

Get the api version of the docker server from the docker version object.

Parameters
versiondocker version
Returns
char* docker server api version

◆ docker_version_arch_get

#define docker_version_arch_get (   version)    get_attr_str((json_object*)version, "Arch")

Get the architecture of the docker server machine from the docker version object.

Parameters
versiondocker version
Returns
char* architecture of the docker server machine

◆ docker_version_build_time_get

#define docker_version_build_time_get (   version)    get_attr_str((json_object*)version, "BuildTime")

Get the build time of the docker server from the docker version object.

Parameters
versiondocker version
Returns
char* build time of the docker server

◆ docker_version_experimental_get

#define docker_version_experimental_get (   version)    get_attr_boolean((json_object*)version, "Experimental")

Get the flag indicating if the docker is running in experimental mode from the docker version object.

Parameters
versiondocker version
Returns
bool flag indicating experimental mode

◆ docker_version_git_commit_get

#define docker_version_git_commit_get (   version)    get_attr_str((json_object*)version, "GitCommit")

Get the git commit id from the docker version object.

Parameters
versiondocker version
Returns
char* git commit id

◆ docker_version_go_version_get

#define docker_version_go_version_get (   version)    get_attr_str((json_object*)version, "GoVersion")

Get the golang version string from the docker version object.

Parameters
versiondocker version
Returns
char* golang version string

◆ docker_version_kernel_version_get

#define docker_version_kernel_version_get (   version)    get_attr_str((json_object*)version, "KernelVersion")

Get the kernel version string from the docker version object.

Parameters
versiondocker version
Returns
char* kernel version string

◆ docker_version_min_api_version_get

#define docker_version_min_api_version_get (   version)    get_attr_str((json_object*)version, "MinAPIVersion")

Get the minimum api version supported by the docker server from the docker version object.

Parameters
versiondocker version
Returns
char* minimum api version supported

◆ docker_version_os_get

#define docker_version_os_get (   version)    get_attr_str((json_object*)version, "Os")

Get the operating system of the docker server from the docker version object.

Parameters
versiondocker version
Returns
char* operating system name

◆ docker_version_version_get

#define docker_version_version_get (   version)    get_attr_str((json_object*)version, "Version")

Get the docker version string from the docker version object.

Parameters
versiondocker version
Returns
char* docker version string

◆ free_docker_df

#define free_docker_df (   df)    json_object_put((json_object*) df)

Free the docker df json object.

Parameters
dfdf object

◆ free_docker_event

#define free_docker_event (   event)    json_object_put((json_object*) event)

Free the docker event json object.

Parameters
eventdocker event object

◆ free_docker_event_list

#define free_docker_event_list (   event_ls)    arraylist_free(event_ls)

Free the docker event list object.

Parameters
event_lsdocker event list

Typedef Documentation

◆ docker_df

typedef json_object docker_df

Docker disk usage (df) json object.

Represents the result of the docker API df call. The json object contains the df objects for:

  • Images
  • Volumes (and their usage)
  • Containers

◆ docker_info

typedef json_object docker_info

Docker Info json object. This object represents the response returned from a docker system info call.

To access the members of docker info use the getters of the form docker_info_<member>_get

◆ docker_version

typedef json_object docker_version

Docker Version json object.

To access members of the docker version object use the getter methods of the form docker_version_<member>_get

Function Documentation

◆ docker_ping()

d_err_t docker_ping ( docker_context ctx)

Ping the docker server. Returns E_SUCCESS(0) if the server is reachable.

Parameters
ctxdocker context
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ docker_system_df()

d_err_t docker_system_df ( docker_context ctx,
docker_df **  df 
)

Gets the docker usage data

Parameters
ctxdocker context
dfobject to return
Returns
error code.

References make_docker_call(), and docker_context_t::url.

◆ docker_system_events()

d_err_t docker_system_events ( docker_context ctx,
arraylist **  events,
time_t  start_time,
time_t  end_time 
)

Get the docker events in a time range.

Parameters
ctxthe docker context
eventsis an array_list containing objects of type docker_event
start_time
end_time
Returns
error code

References docker_log_warn.

◆ docker_system_events_cb()

d_err_t docker_system_events_cb ( docker_context ctx,
void(*)(docker_event *evt, void *cbargs)  docker_events_cb,
void *  cbargs,
arraylist **  events,
time_t  start_time,
time_t  end_time 
)

Get the docker events in a time range.

Parameters
ctxthe docker context
docker_events_cbpointer to callback when an event is received.
cbargsis a pointer to callback arguments
eventsis an array_list containing objects of type docker_event
start_time
end_time
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ docker_system_info()

d_err_t docker_system_info ( docker_context ctx,
docker_info **  info 
)

Gets the docker system information

Parameters
ctxdocker context
infoobject to return
Returns
error code.

References make_docker_call(), and docker_context_t::url.

◆ docker_system_version()

d_err_t docker_system_version ( docker_context ctx,
docker_version **  version 
)

Gets the docker version information

Parameters
ctxdocker context
versiondocker version object to return
Returns
error code.

References make_docker_call(), and docker_context_t::url.