docker

mkvlr 2020-01-28T04:01:42.015300Z

@rahul080327 sorry for the long silence, I’m struggling to find the time to try this out right now but I now asked my colleague to give it a try and will let you know. Our hope is to switch nextjournal over from spotify-docker eventually…

lispyclouds 2020-01-28T06:26:53.017100Z

@christian.paling maybe lein deps :plugin-tree would solve this. And the docker thing can be separated out a bit by having multistage docker files wherein you just copy the uber jar into a plain open jdk image with a lot less size 🙂 I think not having the sources and the huge ~/.m2 dir into your deployment artifact is cleaner

lispyclouds 2020-01-28T06:27:42.017800Z

@mkvlr awesome! lemme know what can be improved!

mkvlr 2020-01-28T18:47:11.019400Z

@rahul080327 one thing that I noticed: there’s no support for checkpoint, yet, correct? https://docs.docker.com/engine/reference/commandline/checkpoint/ This is currently an experimental feature in docker (but we’re using it). Is there an easy way to include it? I see it’s not in https://github.com/lispyclouds/clj-docker-client/blob/master/resources/api/v1.40.yaml

lispyclouds 2020-01-28T20:08:42.021700Z

@mkvlr okay so this is interesting as from my searches I dont think this a properly exposed API. (i may be wrong). Couldn't find it in any of the API clients too. From really deep searching in the docker daemon source I see this: https://github.com/moby/moby/pull/22049/files#diff-8038ade87553e3a654366edca850f83dR11

lispyclouds 2020-01-28T20:09:17.022400Z

looks like this has been implemented for a while but somehow not exposed?

lispyclouds 2020-01-28T20:10:23.023500Z

I tried CURLing the endpoints with curl --unix-socket /var/run/docker.sock "<http://docker/containers/conny/checkpoints>" and it is answering! 😮

lispyclouds 2020-01-28T20:10:57.024100Z

since this is not in the swagger spec, you can try to use the low-level functions in the client though

lispyclouds 2020-01-28T20:12:02.024800Z

(req/fetch {:conn (connect {:uri "unix:///var/run/docker.sock"})
            :url  "/containers/conny/checkpoints"})

lispyclouds 2020-01-28T20:13:34.026Z

needs a (require '[clj-docker-client.requests :as req])

lispyclouds 2020-01-28T20:14:43.027100Z

this should technically work i think. but you need to parse the (JSON?) responses manually.

lispyclouds 2020-01-28T20:15:23.027800Z

i really think the client should stick to published APIs, but what are your thoughts @mkvlr?

lispyclouds 2020-01-28T20:16:14.028300Z

apologies as I haven't really used checkpoints before 😕

lispyclouds 2020-01-28T20:18:07.028700Z

here are some low level comment examples: https://github.com/lispyclouds/clj-docker-client/blob/master/src/clj_docker_client/core.clj#L146-L163

mkvlr 2020-01-28T20:21:58.030100Z

@rahul080327 awesome thanks! I also don’t really understand why it’s not in the swagger api file. Do you know of a way to regenerate this with experimental flags enabled?

mkvlr 2020-01-28T20:22:57.030600Z

it does exist in the docker command line api…

lispyclouds 2020-01-28T20:23:33.031200Z

yes if you know that please answer this too: https://stackoverflow.com/questions/59618439/access-dockers-swagger-yaml-from-docker-api-or-daemon 😛

lispyclouds 2020-01-28T20:23:59.031900Z

i really tried hard to find it, but i think this needs source compilation?

mkvlr 2020-01-28T20:24:40.032200Z

ah right, that would be ideal

lispyclouds 2020-01-28T20:25:17.032800Z

I will try to find out more, but is this a good place for you to start?

mkvlr 2020-01-28T20:25:43.033200Z

yes, for sure!

mkvlr 2020-01-28T20:25:59.033600Z

docker + swagger is pretty much ungooglable

lispyclouds 2020-01-28T20:26:20.034Z

yeah its totally what we are not looking for

lispyclouds 2020-01-28T20:26:48.034600Z

any leads on how to make this lib more flexible is much appreciated too!

lispyclouds 2020-01-28T20:28:04.035200Z

the fact that this is un documented and none of the other clients support is is super weird

mkvlr 2020-01-28T20:28:12.035500Z

> If you omit the version-prefix, the current version of the API (v1.40) is used. For example, calling `/info` is the same as calling `/v1.40/info`. Using the API without a version-prefix is deprecated and will be removed in a future release.

mkvlr 2020-01-28T20:28:22.036Z

what’s being served on /info?

lispyclouds 2020-01-28T20:31:46.036400Z

this returns a map of the system info

mkvlr 2020-01-28T20:32:04.036600Z

ok, not what we’re looking for

lispyclouds 2020-01-28T20:33:36.037300Z

I'm looking at the source of the docker cli to see how its doing it

mkvlr 2020-01-28T20:36:27.038200Z

and https://github.com/moby/moby/blob/master/api/swagger.yaml is just checked in, not generated right?

lispyclouds 2020-01-28T20:37:49.039100Z

looks like it, i at least couldnt find a way to generate it without source compilation. but again, i could be wrong

lispyclouds 2020-01-28T20:39:07.039700Z

otherwise why would it have so many contributors i guess?

mkvlr 2020-01-28T20:39:13.039800Z

gotta go for lunch, bbl

mkvlr 2020-01-28T20:39:21.040100Z

yes, looks like it’s manual

lispyclouds 2020-01-28T20:39:47.040600Z

fun discussion. lemme know if you find anything

lispyclouds 2020-01-28T20:40:08.041100Z

also when would be a good time to release too 🙂