Liking cljdoc? Tell your friends :D

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.

Can you improve this documentation? These fine people already did:
Will Farrell & Sam Saccone
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close