clibdocker
0.1.0-alpha.0
A Docker API for C
|
Docker Images API. More...
#include <coll_arraylist.h>
#include "docker_connection_util.h"
#include "docker_result.h"
#include "docker_util.h"
Go to the source code of this file.
Data Structures | |
struct | docker_progress_detail_t |
Provides progress detail for docker image creation process. More... | |
struct | docker_image_create_status_t |
Docker Image Creation Status is returned when creating a docker image. It is useful for a user facing application to show creation progress. More... | |
struct | docker_build_status_t |
Docker Build Status is used to provide a status update of the docker image build status. More... | |
Macros | |
#define | DEFAULT_DOCKER_FILE_NAME "Dockerfile" |
Default Dockerfile name. | |
#define | docker_image_id_get(img) get_attr_str((json_object*)img, "Id") |
get the docker image id More... | |
#define | docker_image_container_get(img) get_attr_str((json_object*)img, "Container") |
get the docker image container name More... | |
#define | docker_image_comment_get(img) get_attr_str((json_object*)img, "Comment") |
get the docker image comment More... | |
#define | docker_image_os_get(img) get_attr_str((json_object*)img, "Os") |
get the docker image operating system More... | |
#define | docker_image_architecture_get(img) get_attr_str((json_object*)img, "Architecture") |
get the docker image architecture More... | |
#define | docker_image_parent_get(img) get_attr_str((json_object*)img, "Parent") |
get the docker image parent image name More... | |
#define | docker_image_docker_version_get(img) get_attr_str((json_object*)img, "DockerVersion") |
get the docker version of the docker image More... | |
#define | docker_image_virtual_size_get(img) get_attr_long_long((json_object*)img, "VirtualSize") |
get the virtual size of the docker image More... | |
#define | docker_image_size_get(img) get_attr_long_long((json_object*)img, "Size") |
get the size of the docker image More... | |
#define | docker_image_author_get(img) get_attr_str((json_object*)img, "Author") |
get the author of the docker image More... | |
#define | docker_image_created_get(img) get_attr_unsigned_long((json_object*)img, "Created") |
get the created datetime of the docker image More... | |
#define | docker_image_repo_tags_get(img) get_attr_json_object((json_object*)img, "RepoTags") |
get the docker image repo tags More... | |
#define | docker_image_repo_tags_length(img) json_object_array_length(docker_image_repo_tags_get(img)) |
get the length of the repo tags array for the given docker image More... | |
#define | docker_image_repo_tags_get_idx(img, i) (char*)json_object_get_string(json_object_array_get_idx(docker_image_repo_tags_get(img), i)) |
get the ith element of the repo tags array for the given docker image More... | |
#define | docker_image_repo_digests_get(img) get_attr_json_object((json_object*)img, "RepoDigests") |
get the docker image repo digests More... | |
#define | docker_image_repo_digests_length(img) json_object_array_length(docker_image_repo_digests_get(img)) |
get the length of the repo digests array for the given docker image More... | |
#define | docker_image_repo_digests_get_idx(img, i) (char*)json_object_get_string(json_object_array_get_idx(docker_image_repo_digests_get(img), i)) |
get the ith element of the repo digests array for the given docker image More... | |
#define | free_docker_image_list(image_ls) json_object_put(image_ls) |
Free the docker image list object. More... | |
#define | docker_image_list_length(image_ls) json_object_array_length(image_ls) |
Get the list of the docker image list. More... | |
#define | docker_image_list_get_idx(image_ls, i) (docker_image*) json_object_array_get_idx(image_ls, i) |
Get the image at index i from the image list. More... | |
Typedefs | |
typedef json_object | docker_image |
The Docker Image object. More... | |
typedef json_object | docker_image_list |
Docker Image List object. More... | |
typedef struct docker_progress_detail_t | docker_progress_detail |
Provides progress detail for docker image creation process. | |
typedef struct docker_image_create_status_t | docker_image_create_status |
Docker Image Creation Status is returned when creating a docker image. It is useful for a user facing application to show creation progress. | |
typedef struct docker_build_status_t | docker_build_status |
Docker Build Status is used to provide a status update of the docker image build status. | |
Functions | |
d_err_t | docker_images_list (docker_context *ctx, docker_image_list **images, int all, int digests, char *filter_before, int filter_dangling, char *filter_label, char *filter_reference, char *filter_since) |
d_err_t | docker_image_create_from_image (docker_context *ctx, char *from_image, char *tag, char *platform) |
d_err_t | docker_image_create_from_image_cb (docker_context *ctx, void(*status_cb)(docker_image_create_status *, void *cbargs), void *cbargs, char *from_image, char *tag, char *platform) |
d_err_t | docker_image_build_cb (docker_context *ctx, char *folder, char *dockerfile, void(*status_cb)(docker_build_status *, void *cbargs), void *cbargs,...) |
Docker Images API.
#define docker_image_architecture_get | ( | img | ) | get_attr_str((json_object*)img, "Architecture") |
get the docker image architecture
img | docker image |
#define docker_image_author_get | ( | img | ) | get_attr_str((json_object*)img, "Author") |
get the author of the docker image
img | docker image |
#define docker_image_comment_get | ( | img | ) | get_attr_str((json_object*)img, "Comment") |
get the docker image comment
img | docker image |
#define docker_image_container_get | ( | img | ) | get_attr_str((json_object*)img, "Container") |
get the docker image container name
img | docker image |
#define docker_image_created_get | ( | img | ) | get_attr_unsigned_long((json_object*)img, "Created") |
get the created datetime of the docker image
img | docker image |
#define docker_image_docker_version_get | ( | img | ) | get_attr_str((json_object*)img, "DockerVersion") |
get the docker version of the docker image
img | docker image |
#define docker_image_id_get | ( | img | ) | get_attr_str((json_object*)img, "Id") |
get the docker image id
img | docker image |
#define docker_image_list_get_idx | ( | image_ls, | |
i | |||
) | (docker_image*) json_object_array_get_idx(image_ls, i) |
Get the image at index i from the image list.
image_ls | image list |
i | index |
#define docker_image_list_length | ( | image_ls | ) | json_object_array_length(image_ls) |
Get the list of the docker image list.
image_ls | image list |
#define docker_image_os_get | ( | img | ) | get_attr_str((json_object*)img, "Os") |
get the docker image operating system
img | docker image |
#define docker_image_parent_get | ( | img | ) | get_attr_str((json_object*)img, "Parent") |
get the docker image parent image name
img | docker image |
#define docker_image_repo_digests_get | ( | img | ) | get_attr_json_object((json_object*)img, "RepoDigests") |
get the docker image repo digests
Use the docker_image_repo_digests_length
and docker_image_repo_digests_get_idx
to get the individual repo digests.
img | docker image |
#define docker_image_repo_digests_get_idx | ( | img, | |
i | |||
) | (char*)json_object_get_string(json_object_array_get_idx(docker_image_repo_digests_get(img), i)) |
get the ith element of the repo digests array for the given docker image
img | docker image |
i | index |
#define docker_image_repo_digests_length | ( | img | ) | json_object_array_length(docker_image_repo_digests_get(img)) |
get the length of the repo digests array for the given docker image
img | docker image |
#define docker_image_repo_tags_get | ( | img | ) | get_attr_json_object((json_object*)img, "RepoTags") |
get the docker image repo tags
Use the docker_image_repo_tags_length
and docker_image_repo_tags_get_idx
to get the individual repo tags.
img | docker image |
#define docker_image_repo_tags_get_idx | ( | img, | |
i | |||
) | (char*)json_object_get_string(json_object_array_get_idx(docker_image_repo_tags_get(img), i)) |
get the ith element of the repo tags array for the given docker image
img | docker image |
i | index |
#define docker_image_repo_tags_length | ( | img | ) | json_object_array_length(docker_image_repo_tags_get(img)) |
get the length of the repo tags array for the given docker image
img | docker image |
#define docker_image_size_get | ( | img | ) | get_attr_long_long((json_object*)img, "Size") |
get the size of the docker image
img | docker image |
#define docker_image_virtual_size_get | ( | img | ) | get_attr_long_long((json_object*)img, "VirtualSize") |
get the virtual size of the docker image
img | docker image |
#define free_docker_image_list | ( | image_ls | ) | json_object_put(image_ls) |
Free the docker image list object.
image_ls | list |
typedef json_object docker_image |
The Docker Image object.
Represents a docker image object returned in the Docker images API call results. Depending on result, some or all values maybe unavailable.
Use the getters defined in this API to access the members of the Docker Image object.
All getters are of the form docker_image_<member>_get
For example, to get the id of the image use docker_image_id_get(img)
typedef json_object docker_image_list |
Docker Image List object.
This is internally represented as a json array object, which was parsed from a Docker Image API call response.
d_err_t docker_image_build_cb | ( | docker_context * | ctx, |
char * | folder, | ||
char * | dockerfile, | ||
void(*)(docker_build_status *, void *cbargs) | status_cb, | ||
void * | cbargs, | ||
... | |||
) |
see https://docs.docker.com/engine/api/v1.39/#operation/ImageBuild Build a new image from the files in a folder, with a progress callback
ctx | docker context |
folder | the folder containing the docker image build files (if NULL, default is current directory) |
dockerfile | name of the dockerfile. (If NULL, default "Dockerfile" is assumed) |
status_cb | callback to call for updates |
cbargs | callback args for the upate call |
... | options to the build command |
References make_docker_call(), and docker_context_t::url.
d_err_t docker_image_create_from_image | ( | docker_context * | ctx, |
char * | from_image, | ||
char * | tag, | ||
char * | platform | ||
) |
see https://docs.docker.com/engine/api/v1.39/#operation/ImageCreate Create a new image by pulling image:tag for platform
ctx | docker context |
from_image | image name |
tag | which tag to pull, for e.g. "latest" |
platform | which platform to pull the image for (format os[/arch[/variant]]), default is "" |
References docker_image_create_from_image_cb().
d_err_t docker_image_create_from_image_cb | ( | docker_context * | ctx, |
void(*)(docker_image_create_status *, void *cbargs) | status_cb, | ||
void * | cbargs, | ||
char * | from_image, | ||
char * | tag, | ||
char * | platform | ||
) |
see https://docs.docker.com/engine/api/v1.39/#operation/ImageCreate Create a new image by pulling image:tag for platform, with a progress callback
ctx | docker context |
status_cb | callback to call for updates |
cbargs | callback args for the upate call |
from_image | image name |
tag | which tag to pull, for e.g. "latest" |
platform | which platform to pull the image for (format os[/arch[/variant]]), default is "" |
Referenced by docker_image_create_from_image().
d_err_t docker_images_list | ( | docker_context * | ctx, |
docker_image_list ** | images, | ||
int | all, | ||
int | digests, | ||
char * | filter_before, | ||
int | filter_dangling, | ||
char * | filter_label, | ||
char * | filter_reference, | ||
char * | filter_since | ||
) |
List images matching the filters.
ctx | docker context |
images | list of images to be returned |
all | (0 indicates false, true otherwise) |
digests | add repo digests in return object (0 is false, true otherwise) |
filter_before | <image-name>[:<tag>], <image id> or <image@digest> |
filter_dangling | 0 is false, true otherwise. |
filter_label | label=key or label="key=value" of an image label |
filter_reference | <image-name>[:<tag>] |
filter_since | <image-name>[:<tag>], <image id> or <image@digest> |
References make_docker_call(), and docker_context_t::url.