Giter Club home page Giter Club logo

docker-client-clj's Introduction

docker-client

Build Status

An incomplete Docker remote API client written in Clojure. Supports TLS and API version 1.18.

Installation

To install, add the following dependency to your project.clj file:

Clojars Project

Usage

To get started, require the core namespace:

(require '[docker-client.core :as docker])

Next, create a docker client. By default, configuration is pulled from the DOCKER_HOST, DOCKER_CERT_PATH and DOCKER_VERIFY_TLS environment variables. If DOCKER_VERIFY_TLS and DOCKER_CERT_PATH are both set, read credentials from disk and use https. This behavior can be overridden by passing configuration to the docker/client function:

;; creates a client with default configuration from the environment
(def c
  (docker/client))

;; configuration can also be overridden
(def c
  (docker/client {:uri "http://localhost:4343"}))

Once you have a client, you pass it to any of the implemented public functions. So far, that includes:

;; create a container
(let [{id :id} (create-container!
                 c
                 {:cmd ["sleep" "100"]
                  :env ["A_VAR=a_value"]
                  :image "debian:wheezy"})]

  ;; inspect its configuration
  (inspect-container c id)

  ;; start the container
  (start-container! c id)

  ;; stop the container
  (stop-container! c id)

  ;; remove the container
  (remove-container! c id))

Tests

This project uses core.test, so to run tests:

lein test

Future

This client is a work in progress; there are many endpoints left to implement. If you have a pressing need for a particular feature, create an issue.

License

Copyright © 2015 Will Farrell

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

docker-client-clj's People

Contributors

samccone avatar wkf avatar

Stargazers

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

Watchers

 avatar  avatar

docker-client-clj's Issues

Does not work with clojure 1.8.0

just FYI

Caused by: java.lang.NoClassDefFoundError: IllegalName: compile__stub.clj_http.headers.clj-http.headers/HeaderMap
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:654)
at java.lang.ClassLoader.defineClass(ClassLoader.java:761)
at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
at clojure.lang.DynamicClassLoader.defineClass(DynamicClassLoader.java:46)
at clojure.lang.Compiler$NewInstanceExpr.compileStub(Compiler.java:7903)
at clojure.lang.Compiler$NewInstanceExpr.build(Compiler.java:7768)
at clojure.lang.Compiler$NewInstanceExpr$DeftypeParser.parse(Compiler.java:7678)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868)
... 193 more
clj-http needs updating

Some parts of the response from "docker inspect" shouldn't be transformed via kebab-case-keyword

For example, Volumes is returned as a map. The key of each entry represents the path on the host, and the value represents the path on the container. Since the keys in this case are filesystem paths, they're not suitable for conversion to symbols and should be left as strings.

For example,
"/mnt/s3"
gets transformed to
:/mnt/s-3

There may be other parts of the nested data structure that would benefit from being left as strings as well...

Pull endpoint

Hello,

when do you plan to add image pull endpoint?

Thanks for information.

Cheers,
Michael

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.