An idiomatic Clojure Docker client based on the excellent JVM client by Spotify.
The Spotify lib though being excellent, has Java style vararg method calls, non-standard variable passing and undocumented behaviour. This eases out these things to make an idiomatic, clojure friendly API to Docker.
This is a work in progress and aims to be fully compliant and up to date with the Docker API changes.
Leiningen/Boot
[lispyclouds/clj-docker-client "0.1.6"]
Clojure CLI/deps.edn
{lispyclouds/clj-docker-client {:mvn/version "0.1.6"}}
Gradle
compile 'lispyclouds:clj-docker-client:0.1.6'
Maven
<dependency>
<groupId>lispyclouds</groupId>
<artifactId>clj-docker-client</artifactId>
<version>0.1.6</version>
</dependency>
(require '[clj-docker-client.core :as docker])
(def conn (docker/connect))
(docker/disconnect conn)
(docker/ping conn)
(docker/info conn)
(def login-info (docker/register conn "username" "password"))
busybox:musl
image(docker/pull conn "busybox:musl")
(docker/build
conn
"full path to directory containing a Dockerfile"
"repo-name"
"tag")
(docker/push conn "image id or <repo>:<tag>" login-info)
(docker/image-rm conn "image id or <repo>:<tag>")
(docker/image-ls conn)
(docker/commit-container
conn
"container id"
"repo"
"tag"
"entry point command")
busybox:musl
image, a command and a env var(docker/create conn "busybox:musl" "echo hello" {:env "testing"})
(docker/ps conn) ; Only running containers
(docker/ps conn true) ; All containers
(docker/start conn "name or id")
(docker/stop conn "name or id")
(docker/kill conn "name or id")
(docker/restart conn "name or id")
(docker/pause conn "name or id")
(docker/un-pause conn "name or id")
(docker/run conn "image" "command" {:env "test"}) ; Waits for container exit
(docker/run conn "image" "command" {:env "test"} true) ; Detached, returns immediately
(docker/logs conn "name or id")
(docker/container-state conn "name or id")
(docker/rm conn "id or name") ; Remove non-running container
(docker/rm conn "id or name" true) ; Force remove non-running container
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close