Skip to content

Commit

Permalink
fixed 'docker/rm'
Browse files Browse the repository at this point in the history
  • Loading branch information
jlangch committed Sep 17, 2023
1 parent 93ba4a2 commit 1b6efca
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ All notable changes to this project will be documented in this file.

- the functions `time/plus` and `time/minus` to accept `:java.time.Period` and `:java.time.Duration` too as the amount of time to add or subtract

### Fixed

- function `docker/rm`



## [1.10.41] - 2023-09-12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public DocSection section() {
utils.addItem(diBuilder.getDocItem("docker/container-running-with-name?", false));
utils.addItem(diBuilder.getDocItem("docker/container-start-by-name", false));
utils.addItem(diBuilder.getDocItem("docker/container-stop-by-name", false));
utils.addItem(diBuilder.getDocItem("docker/container-remove-by-name", false));
utils.addItem(diBuilder.getDocItem("docker/container-status-by-name", false));
utils.addItem(diBuilder.getDocItem("docker/container-exec-by-name", false));
utils.addItem(diBuilder.getDocItem("docker/container-has-log-msg", false));
Expand Down
33 changes: 30 additions & 3 deletions src/main/resources/com/github/jlangch/venice/docker.venice
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

(def-dynamic *debug* :off)

(defonce binary (system-prop :docker.binary "docker"))


(defn
^{ :arglists '("(docker/debug mode)")
Expand Down Expand Up @@ -619,7 +621,7 @@
cmdargs* (if force (conj cmdargs* "--force") cmdargs*)
cmdargs* (if volumes (conj cmdargs* "--volumes") cmdargs*)
cmdargs* (if (some? link) (into cmdargs* ["--link" link]) cmdargs*)
cmdargs* (conj cmdargs* "container")]
cmdargs* (conj cmdargs* container)]
(:out (apply docker/cmd cmdargs*))))


Expand Down Expand Up @@ -1001,7 +1003,7 @@

cmd [& args]

(let [cmd* (apply str "docker " (interpose " " args))]
(let [cmd* (apply str docker/binary " " (interpose " " args))]
(case docker/*debug*
:off ((docker/os-exec) cmd* :throw-ex true)
:on (do
Expand All @@ -1017,11 +1019,11 @@
;; - docker/images-query-by-repo
;; - docker/image-ready?
;; - docker/container-find-by-name
;; - docker/container-find-by-name
;; - docker/container-exists-with-name?
;; - docker/container-running-with-name?
;; - docker/container-start-by-name
;; - docker/container-stop-by-name
;; - docker/container-remove-by-name
;; - docker/container-status-by-name
;; - docker/container-exec-by-name
;; - docker/container-has-log-msg
Expand Down Expand Up @@ -1233,6 +1235,31 @@
(stop id :time time))))


(defn
^{ :arglists '("(docker/container-remove-by-name name)")
:doc """
Removes a container with the specified name.
"""
:examples '(
"""
(docker/container-remove-by-name "myapp")
""" )
:see-also '(
"docker/run"
"docker/container-find-by-name"
"docker/container-exists-with-name?"
"docker/container-running-with-name?"
"docker/container-start-by-name"
"docker/container-status-by-name"
"docker/container-exec-by-name" ) }

container-remove-by-name [name]

(let [container (first (container-find-by-name name))
id (get container "ID")]
(rm id)))


(defn
^{ :arglists '("(docker/container-status-by-name name)")
:doc """
Expand Down

0 comments on commit 1b6efca

Please sign in to comment.