clibdocker  0.1.0-alpha.0
A Docker API for C
Data Structures | Macros | Typedefs | Enumerations | Functions
docker_containers.h File Reference

Docker Containers API. More...

#include <coll_arraylist.h>
#include "docker_result.h"
#include "docker_connection_util.h"
#include "docker_util.h"
Include dependency graph for docker_containers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  docker_container_change_t
 Docker container change struct. More...
 

Macros

#define free_docker_ctr_port(ctr_port)   json_object_put((json_object*) ctr_port)
 Free the docker container port object. More...
 
#define docker_ctr_port_type_get(ctr_port)   get_attr_str((json_object*)ctr_port, "Type")
 Get the type of docker container port. More...
 
#define docker_ctr_port_private_port_get(ctr_port)   get_attr_long((json_object*)ctr_port, "PrivatePort")
 Get the private port number of the port. More...
 
#define docker_ctr_port_public_port_get(ctr_port)   get_attr_long((json_object*)ctr_port, "PublicPort")
 Get the public port number of the port. More...
 
#define free_docker_ctr_ls_item(ctr)   json_object_put((json_object*) ctr)
 Free the docker container list item object. More...
 
#define docker_ctr_ls_item_id_get(ctr)   get_attr_str((json_object*)ctr, "Id")
 Get the id of the docker container. More...
 
#define docker_ctr_ls_item_names_get(ctr)   get_attr_json_object((json_object*)ctr, "Names")
 Get the names list of the docker container. More...
 
#define docker_ctr_ls_item_names_length(ctr)   json_object_array_length(docker_ctr_ls_item_names_get(ctr))
 Get the length of the names list of the docker container. More...
 
#define docker_ctr_ls_item_names_get_idx(ctr, i)   (char*) json_object_get_string(json_object_array_get_idx(docker_ctr_ls_item_names_get(ctr), i))
 Get the ith name of the docker container. More...
 
#define docker_ctr_ls_item_image_get(ctr)   get_attr_str((json_object*)ctr, "Image")
 Get the image name of the docker container. More...
 
#define docker_ctr_ls_item_image_id_get(ctr)   get_attr_str((json_object*)ctr, "ImageID")
 Get the image id of the docker container. More...
 
#define docker_ctr_ls_item_command_get(ctr)   get_attr_str((json_object*)ctr, "Command")
 Get the command of the docker container. More...
 
#define docker_ctr_ls_item_created_get(ctr)   get_attr_long_long((json_object*)ctr, "Created")
 Get the creation time of the docker container. More...
 
#define docker_ctr_ls_item_state_get(ctr)   get_attr_str((json_object*)ctr, "State")
 Get the state of the docker container. More...
 
#define docker_ctr_ls_item_status_get(ctr)   get_attr_str((json_object*)ctr, "Status")
 Get the status of the docker container. More...
 
#define docker_ctr_ls_item_size_rw_get(ctr)   get_attr_long_long((json_object*)ctr, "SizeRw")
 Get the size of the docker container. More...
 
#define docker_ctr_ls_item_size_root_fs_get(ctr)   get_attr_long_long((json_object*)ctr, "SizeRootFs")
 Get the rootfs size of the docker container. More...
 
#define docker_ctr_ls_item_ports_get(ctr)   get_attr_json_object((json_object*)ctr, "Ports")
 Get the ports of the docker container. More...
 
#define docker_ctr_ls_item_ports_length(ctr)   json_object_array_length(docker_ctr_ls_item_ports_get(ctr))
 Get the length of the ports list of the docker container. More...
 
#define docker_ctr_ls_item_ports_get_idx(ctr, i)   (docker_ctr_port*) json_object_array_get_idx(docker_ctr_ls_item_ports_get(ctr), i)
 Get the ith port of the docker container. More...
 
#define docker_ctr_ls_item_ports_labels_get(ctr)   get_attr_json_object((json_object*)ctr, "Labels")
 Get the port labels of the docker container. More...
 
#define docker_ctr_ls_item_ports_labels_foreach(ctr)   json_object_object_foreach(docker_ctr_ls_item_ports_labels_get(ctr), key, val)
 Iterate over the port labels of the docker container. More...
 
#define free_docker_ctr_list(ctr_ls)   json_object_put(ctr_ls)
 Free the docker container list object. More...
 
#define docker_ctr_list_length(ctr_ls)   json_object_array_length(ctr_ls)
 Get the length of the docker container list. More...
 
#define docker_ctr_list_get_idx(ctr_ls, i)   (docker_ctr*) json_object_array_get_idx(ctr_ls, i)
 Get the ith container list item from the docker container list. More...
 
#define make_docker_ctr_create_params   (docker_ctr_create_params*)json_object_new_object
 Create a new docker container creation params object. More...
 
#define free_docker_ctr_create_params(ctr_create)   json_object_put(ctr_create)
 Free the docker container creation params object. More...
 
#define docker_ctr_create_params_image_set(ctr_create, img)   set_attr_str(ctr_create, "Image", img)
 Set the image name of the container creation params. More...
 
#define docker_ctr_create_params_entrypoint_set(ctr_create, entry)   set_attr_str(ctr_create, "Entrypoint", entry)
 Set the entry point of the container creation params. More...
 
#define docker_ctr_create_params_cmd_add(ctr_create, cmd)   add_array_str(ctr_create, "Cmd", cmd)
 Set the command of the container creation params. More...
 
#define docker_ctr_create_params_env_add(ctr_create, env)   add_array_str(ctr_create, "Env", env)
 Add the environment to the container creation params. More...
 
#define docker_ctr_create_params_tty_set(ctr_create, tty)   set_attr_boolean(ctr_create, "Tty", tty)
 Set the tty flag of the container creation params. More...
 
#define docker_ctr_create_params_openstdin_set(ctr_create, openstdin)   set_attr_boolean(ctr_create, "OpenStdin", openstdin)
 Set the OpenStdin flag of the container creation params. More...
 
#define docker_ctr_create_params_attachstdin_set(ctr_create, attachstdin)   set_attr_boolean(ctr_create, "AttachStdin", attachstdin)
 Set the AttachStdin flag of the container creation params. More...
 
#define docker_ctr_create_params_attachstdout_set(ctr_create, attachstdout)   set_attr_boolean(ctr_create, "AttachStdout", attachstdout)
 Set the AttachStdout flag of the container creation params. More...
 
#define docker_ctr_create_params_attachstderr_set(ctr_create, attachstderr)   set_attr_boolean(ctr_create, "AttachStderr", attachstderr)
 Set the AttachStderr flag of the container creation params. More...
 
#define free_docker_ctr(ctr)   json_object_put((json_object*) ctr)
 Free the docker container object. More...
 
#define docker_ctr_id_get(ctr)   get_attr_str((json_object*)ctr, "Id")
 Get the id of the docker container. More...
 
#define docker_ctr_image_get(ctr)   get_attr_str((json_object*)ctr, "Image")
 Get the image name of the docker container. More...
 
#define docker_ctr_name_get(ctr)   get_attr_str((json_object*)ctr, "Name")
 Get the name of the docker container. More...
 
#define docker_ctr_path_get(ctr)   get_attr_str((json_object*)ctr, "Path")
 Get the path of the docker container. More...
 
#define docker_ctr_created_get(ctr)   get_attr_long_long((json_object*)ctr, "Created")
 Get the creation datetime of the docker container. More...
 
#define docker_ctr_state_get(ctr)   get_attr_str((json_object*)ctr, "State")
 Get the state of the docker container. More...
 
#define docker_ctr_status_get(ctr)   get_attr_str((json_object*)ctr, "Status")
 Get the status of the docker container. More...
 
#define docker_ctr_size_rw_get(ctr)   get_attr_long_long((json_object*)ctr, "SizeRw")
 Get the size of the docker container. More...
 
#define docker_ctr_size_root_fs_get(ctr)   get_attr_long_long((json_object*)ctr, "SizeRootFs")
 Get the rootfs size of the docker container. More...
 
#define docker_ctr_ports_get(ctr)   get_attr_json_object((json_object*)ctr, "Ports")
 Get the ports list of the docker container. More...
 
#define docker_ctr_ports_length(ctr)   json_object_array_length(docker_ctr_ports_get(ctr))
 Get the ports list length of the docker container. More...
 
#define docker_ctr_ports_get_idx(ctr, i)   (docker_ctr_port*) json_object_array_get_idx(docker_ctr_ports_get(ctr), i)
 Get ith port of the docker container. More...
 
#define docker_ctr_ports_labels_get(ctr)   get_attr_json_object((json_object*)ctr, "Labels")
 Get the port labels list of the docker container. More...
 
#define docker_ctr_ports_labels_foreach(ctr)   json_object_object_foreach(docker_ctr_ports_labels_get(ctr), key, val)
 Iterate the port labels of the docker container. More...
 
#define docker_ctr_process_details_length(ctr_ps_ls)   json_object_array_length(ctr_ps_ls)
 Get the Docker containers process details list length. More...
 
#define docker_ctr_process_details_get_idx(ctr_ps_ls, i)   (char*) json_object_array_get_idx(ctr_ps_ls, i)
 Get the ith process from the container process details list. More...
 
#define free_docker_ctr_ps(ctr_ps)   json_object_put((json_object*) ctr_ps)
 Free the docker containers process details object. More...
 
#define docker_ctr_ps_titles_get(ctr_ps)   get_attr_json_object((json_object*)ctr_ps, "Titles")
 Get the titles of the process details titles list. More...
 
#define docker_ctr_ps_titles_length(ctr_ps)   json_object_array_length(docker_ctr_ps_titles_get(ctr_ps))
 Get the titles length of the process details titles list. More...
 
#define docker_ctr_ps_titles_get_idx(ctr_ps, i)   (char*) json_object_get_string(json_object_array_get_idx(docker_ctr_ps_titles_get(ctr_ps), i))
 Get the ith title of the process details titles list. More...
 
#define docker_ctr_ps_processes_get(ctr_ps)   get_attr_json_object((json_object*)ctr_ps, "Processes")
 Get the processes list of the process details. More...
 
#define docker_ctr_ps_processes_length(ctr_ps)   json_object_array_length(docker_ctr_ps_processes_get(ctr_ps))
 Get the processes length of the process details. More...
 
#define docker_ctr_ps_processes_get_idx(ctr_ps, i)   (docker_ctr_process_details*) json_object_array_get_idx(docker_ctr_ps_processes_get(ctr_ps), i)
 Get the ith process of the process details. More...
 
#define docker_percpu_usage_list_length(percpu_usage_ls)   json_object_array_length(percpu_usage_ls)
 Get the length of the PerCPU usage list. More...
 
#define docker_percpu_usage_list_get_idx(percpu_usage_ls, i)   (docker_percpu_usage*) json_object_array_get_idx(percpu_usage_ls, i)
 Get the ith cpu usage item from the percpu usage list. More...
 
#define free_docker_cpu_usage(cpu_usg)   json_object_put((json_object*) cpu_usg)
 Free the docker cpu usage object. More...
 
#define docker_cpu_usage_usermode_get(cpu_usg)   get_attr_long_long((json_object*)cpu_usg, "usage_in_usermode")
 Get the usermode usage from cpu usage object. More...
 
#define docker_cpu_usage_total_get(cpu_usg)   get_attr_long_long((json_object*)cpu_usg, "total_usage")
 Get the total cpu usage from the cpu usage object. More...
 
#define docker_cpu_usage_kernelmode_get(cpu_usg)   get_attr_long_long((json_object*)cpu_usg, "usage_in_kernelmode")
 Get the kernel mode cpu usage from the cpu usage object. More...
 
#define docker_cpu_usage_percpu_usage_get(cpu_usg)   (docker_percpu_usage_list*)get_attr_json_object((json_object*)cpu_usg, "percpu_usage")
 Get the percpu usage from the cpu usage object. More...
 
#define free_docker_throttling_data(throt)   json_object_put((json_object*) throt)
 Free the docker throttling data json object. More...
 
#define docker_throttling_data_periods_get(throt)   get_attr_long_long((json_object*)throt, "periods")
 Get the data periods from the throttling data object. More...
 
#define docker_throttling_data_throttled_periods_get(throt)   get_attr_long_long((json_object*)throt, "throttled_periods")
 Get the throttled periods from the throttling data object. More...
 
#define docker_throttling_data_throttled_time_get(throt)   get_attr_long_long((json_object*)throt, "throttled_time")
 Get the throttled time from the throttling data object. More...
 
#define free_docker_container_cpu_stats(cpu_stats)   json_object_put((json_object*) cpu_stats)
 Free the docker container cpu stats object. More...
 
#define docker_container_cpu_stats_system_cpu_usage_get(cpu_stats)   get_attr_long_long((json_object*)cpu_stats, "system_cpu_usage")
 Get the system cpu usage from the cpu stats. More...
 
#define docker_container_cpu_stats_online_cpus_get(cpu_stats)   get_attr_long((json_object*)cpu_stats, "online_cpus")
 Get the number of online cpus from the cpu stats. More...
 
#define docker_container_cpu_stats_cpu_usage_get(cpu_stats)   (docker_cpu_usage*)get_attr_json_object((json_object*)cpu_stats, "cpu_usage")
 Get the cpu usage from the cpu stats. More...
 
#define docker_container_cpu_stats_throttling_data_get(cpu_stats)   (docker_throttling_data*)get_attr_json_object((json_object*)cpu_stats, "throttling_data")
 Get the throttling data from the cpu stats. More...
 
#define free_docker_container_mem_stats(mem_stats)   json_object_put((json_object*) mem_stats)
 Free the docker container memory stats object. More...
 
#define docker_container_mem_stats_max_usage_get(mem_stats)   get_attr_long_long((json_object*)mem_stats, "max_usage")
 Get the max usage from the memory stats. More...
 
#define docker_container_mem_stats_usage_get(mem_stats)   get_attr_long_long((json_object*)mem_stats, "usage")
 Get the usage from the memory stats. More...
 
#define docker_container_mem_stats_failcnt_get(mem_stats)   get_attr_long_long((json_object*)mem_stats, "failcnt")
 Get the failcnt from the memory stats. More...
 
#define docker_container_mem_stats_limit_get(mem_stats)   get_attr_long_long((json_object*)mem_stats, "limit")
 Get the limit from the memory stats. More...
 
#define docker_container_mem_stats_stats_get(mem_stats)   get_attr_json_object((json_object*)mem_stats, "stats")
 Get the stats map from the memory stats. More...
 
#define docker_container_mem_stats_stats_foreach(mem_stats)   json_object_object_foreach(docker_container_mem_stats_stats_get(mem_stats), key, val)
 Iterate the stats map key,value pair. More...
 
#define free_docker_container_net_stats(net_stats)   json_object_put((json_object*) net_stats)
 Free the docker container net stats json object. More...
 
#define docker_container_net_stats_foreach(net_stats)   json_object_object_foreach(net_stats, key, val)
 Iterate over the net stats key,value pair. More...
 
#define docker_container_net_stats_stats_foreach(net_stats_val)   json_object_object_foreach(net_stats_val, key, val)
 Iterate over stats values key, value pair of each net_stats entry. More...
 
#define free_docker_container_pid_stats(pid_stats)   json_object_put((json_object*) pid_stats)
 Free the docker container pid stats object. More...
 
#define docker_container_pid_stats_foreach(pid_stats)   json_object_object_foreach(pid_stats, key, val)
 Iterate over the key value pair of the pid stats entries. More...
 
#define free_docker_container_stats(stats)   json_object_put((json_object*) stats)
 Free the docker container stats object. More...
 
#define docker_container_stats_read_get(stats)   get_attr_str((json_object*)stats, "read")
 Get the read member from the stats object. More...
 
#define docker_container_stats_pid_stats_get(stats)   (docker_container_pid_stats*)get_attr_json_object((json_object*)stats, "pid_stats")
 Get the container pid stats object. More...
 
#define docker_container_stats_networks_get(stats)   (docker_container_net_stats*)get_attr_json_object((json_object*)stats, "networks")
 Get the container network stats object. More...
 
#define docker_container_stats_mem_stats_get(stats)   (docker_container_mem_stats*)get_attr_json_object((json_object*)stats, "memory_stats")
 Get the container memory stats object. More...
 
#define docker_container_stats_cpu_stats_get(stats)   (docker_container_cpu_stats*)get_attr_json_object((json_object*)stats, "cpu_stats")
 Get the container cpu stats object. More...
 
#define docker_container_stats_precpu_stats_get(stats)   (docker_container_cpu_stats*)get_attr_json_object((json_object*)stats, "precpu_stats")
 Get the container percpu stats object. More...
 

Typedefs

typedef json_object docker_ctr_port
 Docker Container Port json object.
 
typedef json_object docker_ctr_ls_item
 Docker Container list item json object.
 
typedef json_object docker_ctr_list
 Docker Container List json object.
 
typedef json_object docker_ctr_create_params
 Docker Container Creation Parameters json object.
 
typedef json_object docker_ctr
 Docker Container json object. More...
 
typedef json_object docker_ctr_process_details
 Docker container process list object.
 
typedef json_object docker_ctr_ps
 Docker containers process details object.
 
typedef void() docker_log_line_handler(void *handler_args, int stream_id, int line_num, char *line)
 function type for handling log lines received from the get logs api call.
 
typedef struct docker_container_change_t docker_container_change
 Docker container change struct.
 
typedef arraylist docker_changes_list
 Docker Changes list json object.
 
typedef json_object docker_percpu_usage_list
 Docker PerCPU usage list json object.
 
typedef json_object docker_cpu_usage
 Docker cpu usage object.
 
typedef json_object docker_throttling_data
 Docker Throttling Data json object.
 
typedef json_object docker_container_cpu_stats
 Docker Container CPU stats json object.
 
typedef json_object docker_container_mem_stats
 Docker Container Memory Stats json object.
 
typedef json_object docker_container_net_stats
 Docker Container Net Stats json object.
 
typedef json_object docker_container_pid_stats
 Docker Container Pid Stats json object.
 
typedef json_object docker_container_stats
 Docker Container Stats object. More...
 

Enumerations

enum  change_kind { DOCKER_FS_MODIFIED = 0 , DOCKER_FS_ADDED = 1 , DOCKER_FS_DELETED = 2 }
 Enum for the change type of entry in filesystem changes.
 

Functions

d_err_t docker_container_list (docker_context *ctx, docker_ctr_list **container_list, int all, int limit, int size,...)
 
d_err_t docker_container_list_filter_str (docker_context *ctx, docker_ctr_list **container_list, int all, int limit, int size, const char *filters)
 
d_err_t docker_create_container (docker_context *ctx, char **id, docker_ctr_create_params *params)
 Create a docker container given the container creation params. More...
 
docker_ctrdocker_inspect_container (docker_context *ctx, char *id, int size)
 Inspect the docker container given by the id. More...
 
d_err_t docker_process_list_container (docker_context *ctx, docker_ctr_ps **ps, char *id, char *process_args)
 List all processes in a container identified by id. More...
 
d_err_t docker_container_logs (docker_context *ctx, char **log, size_t *log_length, char *id, int follow, int std_out, int std_err, long since, long until, int timestamps, int tail)
 Get the logs for the docker container. More...
 
d_err_t docker_container_logs_foreach (void *handler_args, char *log, size_t log_length, docker_log_line_handler *line_handler)
 Iterate the log lines received from the logs call. More...
 
d_err_t make_docker_container_change (docker_container_change **item, const char *path, const char *kind)
 Create a new container change item. More...
 
void free_docker_container_change (docker_container_change *item)
 Free the docker container change item. More...
 
d_err_t make_docker_changes_list (docker_changes_list **changes_list)
 Create a new docker changes list json object. More...
 
int docker_changes_list_add (docker_changes_list *list, docker_container_change *item)
 Add a container change item to the docker changes list. More...
 
docker_container_changedocker_changes_list_get_idx (docker_changes_list *list, int i)
 Get the ith item from the docker changes list. More...
 
size_t docker_changes_list_length (docker_changes_list *list)
 Get the length of the docker changes list. More...
 
d_err_t docker_container_changes (docker_context *ctx, docker_changes_list **changes, char *id)
 
d_err_t docker_container_get_stats (docker_context *ctx, docker_container_stats **stats, char *id)
 Get stats from a running container. (the non-streaming version) More...
 
d_err_t docker_container_get_stats_cb (docker_context *ctx, void(*docker_container_stats_cb)(docker_container_stats *stats, void *cbargs), void *cbargs, char *id)
 Get stats from a running container. (the streaming version) More...
 
float docker_container_stats_get_cpu_usage_percent (docker_container_stats *stats)
 Get the cpu usage percentage from the docker container stats. More...
 
d_err_t docker_start_container (docker_context *ctx, char *id, char *detachKeys)
 Start a container. More...
 
d_err_t docker_stop_container (docker_context *ctx, char *id, int t)
 Stop a container. More...
 
d_err_t docker_restart_container (docker_context *ctx, char *id, int t)
 Restart a container. More...
 
d_err_t docker_kill_container (docker_context *ctx, char *id, char *signal)
 Kill a container. More...
 
d_err_t docker_rename_container (docker_context *ctx, char *id, char *name)
 Rename a container. More...
 
d_err_t docker_pause_container (docker_context *ctx, char *id)
 Pause a container. More...
 
d_err_t docker_unpause_container (docker_context *ctx, char *id)
 Unpause a container. More...
 
d_err_t docker_wait_container (docker_context *ctx, char *id, char *condition)
 Wait for a container. More...
 
d_err_t docker_remove_container (docker_context *ctx, char *id, int v, int force, int link)
 Remove a container. More...
 
d_err_t docker_container_attach_default (docker_context *ctx, char *id, char *detach_keys, int logs, int stream, int attach_stdin, int attach_stdout, int attach_stderr)
 Attach to a container. More...
 

Detailed Description

Docker Containers API.

Macro Definition Documentation

◆ docker_container_cpu_stats_cpu_usage_get

#define docker_container_cpu_stats_cpu_usage_get (   cpu_stats)    (docker_cpu_usage*)get_attr_json_object((json_object*)cpu_stats, "cpu_usage")

Get the cpu usage from the cpu stats.

Parameters
cpu_statscpu stats object
Returns
long long cpu usage

◆ docker_container_cpu_stats_online_cpus_get

#define docker_container_cpu_stats_online_cpus_get (   cpu_stats)    get_attr_long((json_object*)cpu_stats, "online_cpus")

Get the number of online cpus from the cpu stats.

Parameters
cpu_statscpu stats object
Returns
long online cpus

◆ docker_container_cpu_stats_system_cpu_usage_get

#define docker_container_cpu_stats_system_cpu_usage_get (   cpu_stats)    get_attr_long_long((json_object*)cpu_stats, "system_cpu_usage")

Get the system cpu usage from the cpu stats.

Parameters
cpu_statscpu stats object
Returns
long long system cpu usage

◆ docker_container_cpu_stats_throttling_data_get

#define docker_container_cpu_stats_throttling_data_get (   cpu_stats)    (docker_throttling_data*)get_attr_json_object((json_object*)cpu_stats, "throttling_data")

Get the throttling data from the cpu stats.

Parameters
cpu_statscpu stats object
Returns
docker_throttling_data* throttling data object

◆ docker_container_mem_stats_failcnt_get

#define docker_container_mem_stats_failcnt_get (   mem_stats)    get_attr_long_long((json_object*)mem_stats, "failcnt")

Get the failcnt from the memory stats.

Parameters
mem_statsdocker container memory stats object
Returns
long long failcnt

◆ docker_container_mem_stats_limit_get

#define docker_container_mem_stats_limit_get (   mem_stats)    get_attr_long_long((json_object*)mem_stats, "limit")

Get the limit from the memory stats.

Parameters
mem_statsdocker container memory stats object
Returns
long long limit

◆ docker_container_mem_stats_max_usage_get

#define docker_container_mem_stats_max_usage_get (   mem_stats)    get_attr_long_long((json_object*)mem_stats, "max_usage")

Get the max usage from the memory stats.

Parameters
mem_statsdocker container memory stats object
Returns
long long max usage

◆ docker_container_mem_stats_stats_foreach

#define docker_container_mem_stats_stats_foreach (   mem_stats)    json_object_object_foreach(docker_container_mem_stats_stats_get(mem_stats), key, val)

Iterate the stats map key,value pair.

Parameters
mem_statsdocker container memory stats object

◆ docker_container_mem_stats_stats_get

#define docker_container_mem_stats_stats_get (   mem_stats)    get_attr_json_object((json_object*)mem_stats, "stats")

Get the stats map from the memory stats.

Parameters
mem_statsdocker container memory stats object
Returns
json_object* stats map

◆ docker_container_mem_stats_usage_get

#define docker_container_mem_stats_usage_get (   mem_stats)    get_attr_long_long((json_object*)mem_stats, "usage")

Get the usage from the memory stats.

Parameters
mem_statsdocker container memory stats object
Returns
long long usage

◆ docker_container_net_stats_foreach

#define docker_container_net_stats_foreach (   net_stats)    json_object_object_foreach(net_stats, key, val)

Iterate over the net stats key,value pair.

Parameters
net_statsnet stats object

◆ docker_container_net_stats_stats_foreach

#define docker_container_net_stats_stats_foreach (   net_stats_val)    json_object_object_foreach(net_stats_val, key, val)

Iterate over stats values key, value pair of each net_stats entry.

Parameters
net_stats_valthe net stats value

◆ docker_container_pid_stats_foreach

#define docker_container_pid_stats_foreach (   pid_stats)    json_object_object_foreach(pid_stats, key, val)

Iterate over the key value pair of the pid stats entries.

Parameters
pid_statsdocker container pid stats object

◆ docker_container_stats_cpu_stats_get

#define docker_container_stats_cpu_stats_get (   stats)    (docker_container_cpu_stats*)get_attr_json_object((json_object*)stats, "cpu_stats")

Get the container cpu stats object.

Parameters
statsstats object
Returns
docker_container_cpu_stats* cpu stats object

◆ docker_container_stats_mem_stats_get

#define docker_container_stats_mem_stats_get (   stats)    (docker_container_mem_stats*)get_attr_json_object((json_object*)stats, "memory_stats")

Get the container memory stats object.

Parameters
statsstats object
Returns
docker_container_mem_stats* mem stats object

◆ docker_container_stats_networks_get

#define docker_container_stats_networks_get (   stats)    (docker_container_net_stats*)get_attr_json_object((json_object*)stats, "networks")

Get the container network stats object.

Parameters
statsstats object
Returns
docker_container_net_stats* net stats object

◆ docker_container_stats_pid_stats_get

#define docker_container_stats_pid_stats_get (   stats)    (docker_container_pid_stats*)get_attr_json_object((json_object*)stats, "pid_stats")

Get the container pid stats object.

Parameters
statsstats object
Returns
docker_container_pid_stats* pid stats object

◆ docker_container_stats_precpu_stats_get

#define docker_container_stats_precpu_stats_get (   stats)    (docker_container_cpu_stats*)get_attr_json_object((json_object*)stats, "precpu_stats")

Get the container percpu stats object.

Parameters
statsstats object
Returns
docker_container_percpu_stats* percpu stats object

◆ docker_container_stats_read_get

#define docker_container_stats_read_get (   stats)    get_attr_str((json_object*)stats, "read")

Get the read member from the stats object.

Parameters
statsstats object
Returns
char* read

◆ docker_cpu_usage_kernelmode_get

#define docker_cpu_usage_kernelmode_get (   cpu_usg)    get_attr_long_long((json_object*)cpu_usg, "usage_in_kernelmode")

Get the kernel mode cpu usage from the cpu usage object.

Parameters
cpu_usgdocker cpu usage object
Returns
long long total kernel mode cpu usage

◆ docker_cpu_usage_percpu_usage_get

#define docker_cpu_usage_percpu_usage_get (   cpu_usg)    (docker_percpu_usage_list*)get_attr_json_object((json_object*)cpu_usg, "percpu_usage")

Get the percpu usage from the cpu usage object.

Parameters
cpu_usgdocker cpu usage object
Returns
docker_percpu_usage_list* percpu usage object

◆ docker_cpu_usage_total_get

#define docker_cpu_usage_total_get (   cpu_usg)    get_attr_long_long((json_object*)cpu_usg, "total_usage")

Get the total cpu usage from the cpu usage object.

Parameters
cpu_usgdocker cpu usage object
Returns
long long total cpu usage

◆ docker_cpu_usage_usermode_get

#define docker_cpu_usage_usermode_get (   cpu_usg)    get_attr_long_long((json_object*)cpu_usg, "usage_in_usermode")

Get the usermode usage from cpu usage object.

Parameters
cpu_usgdocker cpu usage object
Returns
long long usermode cpu usage

◆ docker_ctr_create_params_attachstderr_set

#define docker_ctr_create_params_attachstderr_set (   ctr_create,
  attachstderr 
)    set_attr_boolean(ctr_create, "AttachStderr", attachstderr)

Set the AttachStderr flag of the container creation params.

Parameters
ctr_createcontainer creation params
attachstderrflag

◆ docker_ctr_create_params_attachstdin_set

#define docker_ctr_create_params_attachstdin_set (   ctr_create,
  attachstdin 
)    set_attr_boolean(ctr_create, "AttachStdin", attachstdin)

Set the AttachStdin flag of the container creation params.

Parameters
ctr_createcontainer creation params
attachstdinflag

◆ docker_ctr_create_params_attachstdout_set

#define docker_ctr_create_params_attachstdout_set (   ctr_create,
  attachstdout 
)    set_attr_boolean(ctr_create, "AttachStdout", attachstdout)

Set the AttachStdout flag of the container creation params.

Parameters
ctr_createcontainer creation params
attachstdoutflag

◆ docker_ctr_create_params_cmd_add

#define docker_ctr_create_params_cmd_add (   ctr_create,
  cmd 
)    add_array_str(ctr_create, "Cmd", cmd)

Set the command of the container creation params.

Parameters
ctr_createcontainer creation params
cmdCommand

◆ docker_ctr_create_params_entrypoint_set

#define docker_ctr_create_params_entrypoint_set (   ctr_create,
  entry 
)    set_attr_str(ctr_create, "Entrypoint", entry)

Set the entry point of the container creation params.

Parameters
ctr_createcontainer creation params
entryentry point

◆ docker_ctr_create_params_env_add

#define docker_ctr_create_params_env_add (   ctr_create,
  env 
)    add_array_str(ctr_create, "Env", env)

Add the environment to the container creation params.

Parameters
ctr_createcontainer creation params
envEnvironment

◆ docker_ctr_create_params_image_set

#define docker_ctr_create_params_image_set (   ctr_create,
  img 
)    set_attr_str(ctr_create, "Image", img)

Set the image name of the container creation params.

Parameters
ctr_createcontainer creation params
imgimage name

◆ docker_ctr_create_params_openstdin_set

#define docker_ctr_create_params_openstdin_set (   ctr_create,
  openstdin 
)    set_attr_boolean(ctr_create, "OpenStdin", openstdin)

Set the OpenStdin flag of the container creation params.

Parameters
ctr_createcontainer creation params
openstdinflag

◆ docker_ctr_create_params_tty_set

#define docker_ctr_create_params_tty_set (   ctr_create,
  tty 
)    set_attr_boolean(ctr_create, "Tty", tty)

Set the tty flag of the container creation params.

Parameters
ctr_createcontainer creation params
tty

◆ docker_ctr_created_get

#define docker_ctr_created_get (   ctr)    get_attr_long_long((json_object*)ctr, "Created")

Get the creation datetime of the docker container.

Parameters
ctrdocker container object
Returns
long long creation datetime

◆ docker_ctr_id_get

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

Get the id of the docker container.

Parameters
ctrdocker container object
Returns
char* container id

◆ docker_ctr_image_get

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

Get the image name of the docker container.

Parameters
ctrdocker container object
Returns
char* container image name

◆ docker_ctr_list_get_idx

#define docker_ctr_list_get_idx (   ctr_ls,
 
)    (docker_ctr*) json_object_array_get_idx(ctr_ls, i)

Get the ith container list item from the docker container list.

Parameters
ctr_lsdocker container list
iindex
Returns
docker_ctr* container object

◆ docker_ctr_list_length

#define docker_ctr_list_length (   ctr_ls)    json_object_array_length(ctr_ls)

Get the length of the docker container list.

Parameters
ctr_lsdocker container list
Returns
size_t container list length

◆ docker_ctr_ls_item_command_get

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

Get the command of the docker container.

Parameters
ctrdocker container object
Returns
char* docker container command

◆ docker_ctr_ls_item_created_get

#define docker_ctr_ls_item_created_get (   ctr)    get_attr_long_long((json_object*)ctr, "Created")

Get the creation time of the docker container.

Parameters
ctrdocker container object
Returns
long long docker container creation time

◆ docker_ctr_ls_item_id_get

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

Get the id of the docker container.

Parameters
ctrdocker container object
Returns
char* docker container id

◆ docker_ctr_ls_item_image_get

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

Get the image name of the docker container.

Parameters
ctrdocker container object
Returns
char* docker container image name

◆ docker_ctr_ls_item_image_id_get

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

Get the image id of the docker container.

Parameters
ctrdocker container object
Returns
char* docker container image id

◆ docker_ctr_ls_item_names_get

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

Get the names list of the docker container.

Parameters
ctrdocker container object
Returns
json_object* names list of the docker container

◆ docker_ctr_ls_item_names_get_idx

#define docker_ctr_ls_item_names_get_idx (   ctr,
 
)    (char*) json_object_get_string(json_object_array_get_idx(docker_ctr_ls_item_names_get(ctr), i))

Get the ith name of the docker container.

Parameters
ctrdocker container object
iindex
Returns
char* ith name of the docker container

◆ docker_ctr_ls_item_names_length

#define docker_ctr_ls_item_names_length (   ctr)    json_object_array_length(docker_ctr_ls_item_names_get(ctr))

Get the length of the names list of the docker container.

Parameters
ctrdocker container object
Returns
size_t length of the names list

◆ docker_ctr_ls_item_ports_get

#define docker_ctr_ls_item_ports_get (   ctr)    get_attr_json_object((json_object*)ctr, "Ports")

Get the ports of the docker container.

Parameters
ctrdocker container object
Returns
json_object* ports list

◆ docker_ctr_ls_item_ports_get_idx

#define docker_ctr_ls_item_ports_get_idx (   ctr,
 
)    (docker_ctr_port*) json_object_array_get_idx(docker_ctr_ls_item_ports_get(ctr), i)

Get the ith port of the docker container.

Parameters
ctrdocker container object
iindex
Returns
docker_ctr_port* ith port docker container

◆ docker_ctr_ls_item_ports_labels_foreach

#define docker_ctr_ls_item_ports_labels_foreach (   ctr)    json_object_object_foreach(docker_ctr_ls_item_ports_labels_get(ctr), key, val)

Iterate over the port labels of the docker container.

Parameters
ctrdocker container object

◆ docker_ctr_ls_item_ports_labels_get

#define docker_ctr_ls_item_ports_labels_get (   ctr)    get_attr_json_object((json_object*)ctr, "Labels")

Get the port labels of the docker container.

Parameters
ctrdocker container object
Returns
json_object* port labels

◆ docker_ctr_ls_item_ports_length

#define docker_ctr_ls_item_ports_length (   ctr)    json_object_array_length(docker_ctr_ls_item_ports_get(ctr))

Get the length of the ports list of the docker container.

Parameters
ctrdocker container object
Returns
size_t ports list length

◆ docker_ctr_ls_item_size_root_fs_get

#define docker_ctr_ls_item_size_root_fs_get (   ctr)    get_attr_long_long((json_object*)ctr, "SizeRootFs")

Get the rootfs size of the docker container.

Parameters
ctrdocker container object
Returns
long long docker container rootfs size

◆ docker_ctr_ls_item_size_rw_get

#define docker_ctr_ls_item_size_rw_get (   ctr)    get_attr_long_long((json_object*)ctr, "SizeRw")

Get the size of the docker container.

Parameters
ctrdocker container object
Returns
long long docker container size

◆ docker_ctr_ls_item_state_get

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

Get the state of the docker container.

Parameters
ctrdocker container object
Returns
char* docker container state

◆ docker_ctr_ls_item_status_get

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

Get the status of the docker container.

Parameters
ctrdocker container object
Returns
char* docker container status

◆ docker_ctr_name_get

#define docker_ctr_name_get (   ctr)    get_attr_str((json_object*)ctr, "Name")

Get the name of the docker container.

Parameters
ctrdocker container object
Returns
char* name

◆ docker_ctr_path_get

#define docker_ctr_path_get (   ctr)    get_attr_str((json_object*)ctr, "Path")

Get the path of the docker container.

Parameters
ctrdocker container object
Returns
char* path

◆ docker_ctr_port_private_port_get

#define docker_ctr_port_private_port_get (   ctr_port)    get_attr_long((json_object*)ctr_port, "PrivatePort")

Get the private port number of the port.

Parameters
ctr_portdocker container port object
Returns
long private port number

◆ docker_ctr_port_public_port_get

#define docker_ctr_port_public_port_get (   ctr_port)    get_attr_long((json_object*)ctr_port, "PublicPort")

Get the public port number of the port.

Parameters
ctr_portdocker container port object
Returns
long public port number

◆ docker_ctr_port_type_get

#define docker_ctr_port_type_get (   ctr_port)    get_attr_str((json_object*)ctr_port, "Type")

Get the type of docker container port.

Parameters
ctr_portdocker container port object
Returns
char* port type

◆ docker_ctr_ports_get

#define docker_ctr_ports_get (   ctr)    get_attr_json_object((json_object*)ctr, "Ports")

Get the ports list of the docker container.

Parameters
ctrdocker container object
Returns
json_object* ports list

◆ docker_ctr_ports_get_idx

#define docker_ctr_ports_get_idx (   ctr,
 
)    (docker_ctr_port*) json_object_array_get_idx(docker_ctr_ports_get(ctr), i)

Get ith port of the docker container.

Parameters
ctrdocker container object
iindex
Returns
docker_ctr_port* ith container port

◆ docker_ctr_ports_labels_foreach

#define docker_ctr_ports_labels_foreach (   ctr)    json_object_object_foreach(docker_ctr_ports_labels_get(ctr), key, val)

Iterate the port labels of the docker container.

Parameters
ctrdocker container object

◆ docker_ctr_ports_labels_get

#define docker_ctr_ports_labels_get (   ctr)    get_attr_json_object((json_object*)ctr, "Labels")

Get the port labels list of the docker container.

Parameters
ctrdocker container object
Returns
json_object* port labels

◆ docker_ctr_ports_length

#define docker_ctr_ports_length (   ctr)    json_object_array_length(docker_ctr_ports_get(ctr))

Get the ports list length of the docker container.

Parameters
ctrdocker container object
Returns
size_t ports list length

◆ docker_ctr_process_details_get_idx

#define docker_ctr_process_details_get_idx (   ctr_ps_ls,
 
)    (char*) json_object_array_get_idx(ctr_ps_ls, i)

Get the ith process from the container process details list.

Parameters
ctr_ps_lscontainers process details list
iindex
Returns
char* ith process

◆ docker_ctr_process_details_length

#define docker_ctr_process_details_length (   ctr_ps_ls)    json_object_array_length(ctr_ps_ls)

Get the Docker containers process details list length.

Parameters
ctr_ps_lscontainers process details list
Returns
size_t length of the containers process list

◆ docker_ctr_ps_processes_get

#define docker_ctr_ps_processes_get (   ctr_ps)    get_attr_json_object((json_object*)ctr_ps, "Processes")

Get the processes list of the process details.

Parameters
ctr_psdocker containers process object
Returns
json_object* processes list object

◆ docker_ctr_ps_processes_get_idx

#define docker_ctr_ps_processes_get_idx (   ctr_ps,
 
)    (docker_ctr_process_details*) json_object_array_get_idx(docker_ctr_ps_processes_get(ctr_ps), i)

Get the ith process of the process details.

Parameters
ctr_psdocker containers process object
iindex
Returns
docker_ctr_process_details* process details object

◆ docker_ctr_ps_processes_length

#define docker_ctr_ps_processes_length (   ctr_ps)    json_object_array_length(docker_ctr_ps_processes_get(ctr_ps))

Get the processes length of the process details.

Parameters
ctr_psdocker containers process object
Returns
size_t processes length

◆ docker_ctr_ps_titles_get

#define docker_ctr_ps_titles_get (   ctr_ps)    get_attr_json_object((json_object*)ctr_ps, "Titles")

Get the titles of the process details titles list.

Parameters
ctr_psdocker containers process object
Returns
json_object* titles list object

◆ docker_ctr_ps_titles_get_idx

#define docker_ctr_ps_titles_get_idx (   ctr_ps,
 
)    (char*) json_object_get_string(json_object_array_get_idx(docker_ctr_ps_titles_get(ctr_ps), i))

Get the ith title of the process details titles list.

Parameters
ctr_psdocker containers process object
iindex
Returns
char* ith title

◆ docker_ctr_ps_titles_length

#define docker_ctr_ps_titles_length (   ctr_ps)    json_object_array_length(docker_ctr_ps_titles_get(ctr_ps))

Get the titles length of the process details titles list.

Parameters
ctr_psdocker containers process object
Returns
size_t titles length

◆ docker_ctr_size_root_fs_get

#define docker_ctr_size_root_fs_get (   ctr)    get_attr_long_long((json_object*)ctr, "SizeRootFs")

Get the rootfs size of the docker container.

Parameters
ctrdocker container object
Returns
long long rootfs size

◆ docker_ctr_size_rw_get

#define docker_ctr_size_rw_get (   ctr)    get_attr_long_long((json_object*)ctr, "SizeRw")

Get the size of the docker container.

Parameters
ctrdocker container object
Returns
long long container size

◆ docker_ctr_state_get

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

Get the state of the docker container.

Parameters
ctrdocker container object
Returns
char* container state

◆ docker_ctr_status_get

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

Get the status of the docker container.

Parameters
ctrdocker container object
Returns
char* container status

◆ docker_percpu_usage_list_get_idx

#define docker_percpu_usage_list_get_idx (   percpu_usage_ls,
 
)    (docker_percpu_usage*) json_object_array_get_idx(percpu_usage_ls, i)

Get the ith cpu usage item from the percpu usage list.

Parameters
percpu_usage_lsusage list
iindex
Returns
docker_percpu_usage* cpu usage object

◆ docker_percpu_usage_list_length

#define docker_percpu_usage_list_length (   percpu_usage_ls)    json_object_array_length(percpu_usage_ls)

Get the length of the PerCPU usage list.

Parameters
percpu_usage_lspercpu usage list
Returns
size_t length of the percpu usage list

◆ docker_throttling_data_periods_get

#define docker_throttling_data_periods_get (   throt)    get_attr_long_long((json_object*)throt, "periods")

Get the data periods from the throttling data object.

Parameters
throtthe throttling data object
Returns
long long periods

◆ docker_throttling_data_throttled_periods_get

#define docker_throttling_data_throttled_periods_get (   throt)    get_attr_long_long((json_object*)throt, "throttled_periods")

Get the throttled periods from the throttling data object.

Parameters
throtthe throttling data object
Returns
long long throttled periods

◆ docker_throttling_data_throttled_time_get

#define docker_throttling_data_throttled_time_get (   throt)    get_attr_long_long((json_object*)throt, "throttled_time")

Get the throttled time from the throttling data object.

Parameters
throtthe throttling data object
Returns
long long throttled time

◆ free_docker_container_cpu_stats

#define free_docker_container_cpu_stats (   cpu_stats)    json_object_put((json_object*) cpu_stats)

Free the docker container cpu stats object.

Parameters
cpu_statscpu stats object

◆ free_docker_container_mem_stats

#define free_docker_container_mem_stats (   mem_stats)    json_object_put((json_object*) mem_stats)

Free the docker container memory stats object.

Parameters
mem_statsdocker container memory stats object

◆ free_docker_container_net_stats

#define free_docker_container_net_stats (   net_stats)    json_object_put((json_object*) net_stats)

Free the docker container net stats json object.

Parameters
net_statsstats object

◆ free_docker_container_pid_stats

#define free_docker_container_pid_stats (   pid_stats)    json_object_put((json_object*) pid_stats)

Free the docker container pid stats object.

Parameters
pid_statsdocker container pid stats object

◆ free_docker_container_stats

#define free_docker_container_stats (   stats)    json_object_put((json_object*) stats)

Free the docker container stats object.

Parameters
statsstats object

◆ free_docker_cpu_usage

#define free_docker_cpu_usage (   cpu_usg)    json_object_put((json_object*) cpu_usg)

Free the docker cpu usage object.

Parameters
cpu_usgdocker cpu usage object

◆ free_docker_ctr

#define free_docker_ctr (   ctr)    json_object_put((json_object*) ctr)

Free the docker container object.

Parameters
ctrdocker container object

◆ free_docker_ctr_create_params

#define free_docker_ctr_create_params (   ctr_create)    json_object_put(ctr_create)

Free the docker container creation params object.

Parameters
ctr_createcontainer creation params

◆ free_docker_ctr_list

#define free_docker_ctr_list (   ctr_ls)    json_object_put(ctr_ls)

Free the docker container list object.

Parameters
ctr_lsdocker container list

◆ free_docker_ctr_ls_item

#define free_docker_ctr_ls_item (   ctr)    json_object_put((json_object*) ctr)

Free the docker container list item object.

Parameters
ctrdocker container object

◆ free_docker_ctr_port

#define free_docker_ctr_port (   ctr_port)    json_object_put((json_object*) ctr_port)

Free the docker container port object.

Parameters
ctr_portdocker container port object

◆ free_docker_ctr_ps

#define free_docker_ctr_ps (   ctr_ps)    json_object_put((json_object*) ctr_ps)

Free the docker containers process details object.

Parameters
ctr_psdocker containers process object

◆ free_docker_throttling_data

#define free_docker_throttling_data (   throt)    json_object_put((json_object*) throt)

Free the docker throttling data json object.

Parameters
throtthe throttling data object

◆ make_docker_ctr_create_params

#define make_docker_ctr_create_params   (docker_ctr_create_params*)json_object_new_object

Create a new docker container creation params object.

Returns
docker_ctr_create_params* container creation params object

Typedef Documentation

◆ docker_container_stats

typedef json_object docker_container_stats

Docker Container Stats object.

This is the overall stats object which can be used to access:

  • Pid stats
  • Net stats
  • Memory stats
  • CPU stats
  • PerCPU stats

◆ docker_ctr

typedef json_object docker_ctr

Docker Container json object.

NOTE: this is different from the docker_ctr_ls_item object which is part of the docker container list query response. This is largely a quirk of the Docker API.

Function Documentation

◆ docker_changes_list_add()

int docker_changes_list_add ( docker_changes_list list,
docker_container_change item 
)

Add a container change item to the docker changes list.

Parameters
listchanges list
itemchange item
Returns
int error code

◆ docker_changes_list_get_idx()

docker_container_change* docker_changes_list_get_idx ( docker_changes_list list,
int  i 
)

Get the ith item from the docker changes list.

Parameters
listchanges list
iindex
Returns
docker_container_change* change item at ith index

◆ docker_changes_list_length()

size_t docker_changes_list_length ( docker_changes_list list)

Get the length of the docker changes list.

Parameters
listchnages list
Returns
size_t length of the changes list

◆ docker_container_attach_default()

d_err_t docker_container_attach_default ( docker_context ctx,
char *  id,
char *  detach_keys,
int  logs,
int  stream,
int  attach_stdin,
int  attach_stdout,
int  attach_stderr 
)

Attach to a container.

Parameters
ctxdocker context
idcontainer id
detach_keysdetach keys
logslogs enabled
streamstream enabled
attach_stdinattach stdin flag
attach_stdoutattach stdout flag
attach_stderrattach stderr flag
Returns
d_err_t error code

References make_docker_call(), and docker_context_t::url.

◆ docker_container_changes()

d_err_t docker_container_changes ( docker_context ctx,
docker_changes_list **  changes,
char *  id 
)

Get the file system changes for the docker container.

Parameters
ctxdocker context
changespointer to struct to be returned.
idcontainer id
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ docker_container_get_stats()

d_err_t docker_container_get_stats ( docker_context ctx,
docker_container_stats **  stats,
char *  id 
)

Get stats from a running container. (the non-streaming version)

Parameters
ctxdocker context
statsthe stats object to return
idcontainer id
Returns
error code

◆ docker_container_get_stats_cb()

d_err_t docker_container_get_stats_cb ( docker_context ctx,
void(*)(docker_container_stats *stats, void *cbargs)  docker_container_stats_cb,
void *  cbargs,
char *  id 
)

Get stats from a running container. (the streaming version)

Parameters
ctxdocker context
docker_container_stats_cbthe callback which receives the stats object, and any client args
cbargsclient args to be passed on to the callback (closure)
idcontainer id
Returns
error code

◆ docker_container_list()

d_err_t docker_container_list ( docker_context ctx,
docker_ctr_list **  container_list,
int  all,
int  limit,
int  size,
  ... 
)

List docker containers

Parameters
ctxthe docker context
container_listarray_list of containers to be returned
allall or running only
limitmax containers to return
sizereturn the size of containers in response
...pairs of filters char* filter_name, char* filter_value (terminated by a NULL)
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ docker_container_list_filter_str()

d_err_t docker_container_list_filter_str ( docker_context ctx,
docker_ctr_list **  container_list,
int  all,
int  limit,
int  size,
const char *  filters 
)

List docker containers

Parameters
ctxthe docker context
container_listarray_list of containers to be returned
allall or running only
limitmax containers to return
sizereturn the size of containers in response
filtersfilters json object as string
Returns
error code

◆ docker_container_logs()

d_err_t docker_container_logs ( docker_context ctx,
char **  log,
size_t *  log_length,
char *  id,
int  follow,
int  std_out,
int  std_err,
long  since,
long  until,
int  timestamps,
int  tail 
)

Get the logs for the docker container.

Parameters
ctxdocker context
logpointer to buffer of chars to be returned. (Not null terminated string).
log_lengthpointer to log_length to be returned.
idcontainer id
follow- this param has no effect for now, as socket support is not implemented.
std_outwhether to get stdout (>0 means yes)
std_errwhether to get stdin (>0 means yes)
sincetime since which the logs are to be fetched (unix timestamp)
untiltime till which the logs are to be fetched (unix timestamp)
timestampsadd timestamps to log lines (>0 means yes)
tail0 means all, any positive number indicates the number of lines to fetch.
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ docker_container_logs_foreach()

d_err_t docker_container_logs_foreach ( void *  handler_args,
char *  log,
size_t  log_length,
docker_log_line_handler line_handler 
)

Iterate the log lines received from the logs call.

Parameters
handler_argsargs passed to each call of log line handler function
loglog text
log_lengthlog text length
line_handlerthe log line handler function to call
Returns
d_err_t error code

◆ docker_container_stats_get_cpu_usage_percent()

float docker_container_stats_get_cpu_usage_percent ( docker_container_stats stats)

Get the cpu usage percentage from the docker container stats.

Parameters
statsdocker container stats
Returns
float cpu usage percentage

References docker_container_cpu_stats_cpu_usage_get, docker_container_cpu_stats_online_cpus_get, docker_container_cpu_stats_system_cpu_usage_get, docker_container_stats_cpu_stats_get, docker_container_stats_precpu_stats_get, and docker_cpu_usage_total_get.

◆ docker_create_container()

d_err_t docker_create_container ( docker_context ctx,
char **  id,
docker_ctr_create_params params 
)

Create a docker container given the container creation params.

Parameters
ctxdocker context
idcontainer id
paramsdocker container creation params
Returns
d_err_t error code

References make_docker_call(), and docker_context_t::url.

◆ docker_inspect_container()

docker_ctr* docker_inspect_container ( docker_context ctx,
char *  id,
int  size 
)

Inspect the docker container given by the id.

Parameters
ctxdocker context
idcontainer id
size//TODO: remove unused
Returns
MODULE_API*

References make_docker_call(), and docker_context_t::url.

◆ docker_kill_container()

d_err_t docker_kill_container ( docker_context ctx,
char *  id,
char *  signal 
)

Kill a container.

Parameters
ctxdocker context
idcontainer id
signal(optional - NULL for default i.e. SIGKILL) signal name to send
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ docker_pause_container()

d_err_t docker_pause_container ( docker_context ctx,
char *  id 
)

Pause a container.

Parameters
ctxdocker context
idcontainer id
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ docker_process_list_container()

d_err_t docker_process_list_container ( docker_context ctx,
docker_ctr_ps **  ps,
char *  id,
char *  process_args 
)

List all processes in a container identified by id.

Parameters
ctxis a docker context
psis the pointer to the process list to be returned.
idis the container id
process_argsis the command line args to be passed to the ps command (can be NULL).
Returns
error code of the result

References make_docker_call(), and docker_context_t::url.

◆ docker_remove_container()

d_err_t docker_remove_container ( docker_context ctx,
char *  id,
int  v,
int  force,
int  link 
)

Remove a container.

Parameters
ctxdocker context
idcontainer id
vremove volumes associated with the container
forceif the container is running, kill it before removing it.
linkremove specified link
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ docker_rename_container()

d_err_t docker_rename_container ( docker_context ctx,
char *  id,
char *  name 
)

Rename a container.

Parameters
ctxdocker context
idcontainer id
namenew name for the container
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ docker_restart_container()

d_err_t docker_restart_container ( docker_context ctx,
char *  id,
int  t 
)

Restart a container.

Parameters
ctxdocker context
idcontainer id
tnumber of seconds to wait before killing the container
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ docker_start_container()

d_err_t docker_start_container ( docker_context ctx,
char *  id,
char *  detachKeys 
)

Start a container.

Parameters
ctxdocker context
idcontainer id
detachKeys(optional) key combination for detaching a container.
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ docker_stop_container()

d_err_t docker_stop_container ( docker_context ctx,
char *  id,
int  t 
)

Stop a container.

Parameters
ctxdocker context
idcontainer id
tnumber of seconds to wait before killing the container
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ docker_unpause_container()

d_err_t docker_unpause_container ( docker_context ctx,
char *  id 
)

Unpause a container.

Parameters
ctxdocker context
idcontainer id
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ docker_wait_container()

d_err_t docker_wait_container ( docker_context ctx,
char *  id,
char *  condition 
)

Wait for a container.

Parameters
ctxdocker context
idcontainer id
condition(optional - NULL for default "not-running") condition to wait for
Returns
error code

References make_docker_call(), and docker_context_t::url.

◆ free_docker_container_change()

void free_docker_container_change ( docker_container_change item)

Free the docker container change item.

Parameters
itemto free

References docker_container_change_t::path.

Referenced by make_docker_changes_list().

◆ make_docker_changes_list()

d_err_t make_docker_changes_list ( docker_changes_list **  changes_list)

Create a new docker changes list json object.

Parameters
changes_listobject to create and return
Returns
d_err_t error code

References free_docker_container_change().

◆ make_docker_container_change()

d_err_t make_docker_container_change ( docker_container_change **  item,
const char *  path,
const char *  kind 
)

Create a new container change item.

Parameters
itemto create and return
pathpath of file changed
kindtype of change
Returns
d_err_t error code