Giter VIP home page Giter VIP logo

libdocker's Introduction

libdocker: an SDK for the Docker Engine API in C

A minimalist SDK for accessing the Docker Engine API via C.

Getting started

libdocker depends on curl, which can be installed easily via most package managers or from source. A typical workflow:

  • docker_init initializes a UNIX socket connection to the Docker Engine
  • docker_post and docker_get send requests to the Docker Engine REST API
  • docker_buffer gets response data
  • docker_destroy destroys docker object and frees any associated memory

Building the Code

  • Run the compile script to build the code. By default the example will be part of the build process. ( If anybody wants to not build the example, they can manually edit the base CMakeLists. In future, the compile script will accomodate the option.)
  • If the build is successful, then a deb package will be created in the build directory. Use the command sudo dpkg -i <deb package name> to install the package.
  • This will add libdocker.so to the /usr/lib directory and the example executable docker_example in /usr/bin
  • Also this will add the docker.h header file to /usr/include. If anybody wants to just use the library for dev purpose, they can include it directly.
  • Use the sudo command to run the executable created.
  • To remove the package ( i.e. the .so file, the docker.h header and the example executable in future ), use the command sudo dpkg -r docker_c_sdk

The library is pretty low-level for now (i.e., doesn't support parsing JSON responses or have any functions higher-level than post or get). An example application:

Multi-threaded applications

Should be fine, but be sure to have a look at curl's page on the subject (link here).

libdocker's People

Contributors

ciaran2 avatar danielsuo avatar nvzflow avatar schaffung avatar zstewar1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

libdocker's Issues

Need a way to get HTTP response codes from request methods

The most obvious way would be to add an outparam to the request functions, e.g. CURLcode docker_get(DOCKER *client, char *url, long *http_code) but given that this is a breaking API change it's best if there's some agreement before someone does any development.

Error while building with CMAKE

I created a new C99 project using CLion. Here I modified CMakeLists.txt and main.c files to the one given in README. Your libdocker project is in lib directory of the main project.

I am getting 2 CMake errors:
CMake Error at CMakeLists.txt:20 (target_include_directories):
Cannot specify include directories for target "libdocker_inte" which is not
built by this project.
CMake Error at CMakeLists.txt:26 (target_link_libraries):
Cannot specify link libraries for target "libdocker_inte" which is not
built by this project.

Here's my main project's CMake file
CMakeLists.txt

Can you help me in determining why I might be getting this error ?

Licensing the project

According to github:licensing-a-repository

"You're under no obligation to choose a license. However, without a license, the default copyright laws apply, meaning that you retain all rights to your source code and no one may reproduce, distribute, or create derivative works from your work. If you're creating an open source project, we strongly encourage you to include an open source license. The Open Source Guide provides additional guidance on choosing the correct license for your project."

My intention was to use this project as a dependency for another one but since it doesn't have any explicit license I can't use it. Would you like to retain all rights or maybe some kind of open source license looks good?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.