This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-07
Channels
- # adventofcode (40)
- # aws (15)
- # babashka (76)
- # beginners (39)
- # calva (6)
- # cider (3)
- # clj-kondo (3)
- # clojure (89)
- # clojure-austin (1)
- # clojure-australia (4)
- # clojure-europe (42)
- # clojure-italy (9)
- # clojure-nl (27)
- # clojure-spec (8)
- # clojure-uk (17)
- # clojurescript (9)
- # conjure (1)
- # data-science (1)
- # datomic (19)
- # deps-new (4)
- # docker (9)
- # emacs (5)
- # events (1)
- # fulcro (36)
- # kaocha (31)
- # lambdaisland (5)
- # leiningen (3)
- # membrane (3)
- # nrepl (10)
- # off-topic (31)
- # pedestal (7)
- # reveal (47)
- # shadow-cljs (35)
- # sql (9)
- # test-check (1)
- # tools-deps (24)
- # uncomplicate (12)
- # xtdb (5)
Hmm, trying to authenticate to a private registry with clj-docker-client, but didn't quite yet succeed
the api docs (https://docs.docker.com/engine/api/v1.40/#section/Authentication) mention a X-Registry-Auth
header, but didn't find out how to include it in :ImageCreate
operation
(defn- encode-base64
[input]
(.encodeToString (java.util.Base64/getEncoder) (.getBytes input)))
(def ^:private registry-auth
(encode-base64
(json/write-str
{:username "_json_key",
:password (json/write-str (edn/read-string (slurp "auth.edn"))),
:email "[email protected]",
:serveraddress ""})))
(d/invoke images
{:op :ImageCreate,
:params {:fromImage image-name,
:X-Registry-Auth registry-auth}}))
there's also /auth
endpoint, posting to it seems to make a login to my private registry, but the response gives an empty IdentityToken
(req/fetch {:conn (req/connect* {:uri "unix:///var/run/docker.sock"})
:url "/v1.40/auth"
:method :post
:body {:username "reader"
:password "bar"
:serveraddress "localhost:5000"}})
"{\"IdentityToken\":\"\",\"Status\":\"Login Succeeded\"}\n"