[WIP] docker inspection fs (/dev/docker in a container), for exposing the Swarm task slot#24893
[WIP] docker inspection fs (/dev/docker in a container), for exposing the Swarm task slot#24893AkihiroSuda wants to merge 2 commits intomoby:masterfrom
Conversation
Signed-off-by: Akihiro Suda <[email protected]>
Provides the following files for exposing task information to containers: - /dev/docker/container/json - /dev/docker/swarm/task/json /dev/docker is mounted by default for tasks, but not mounted for non-task containers. (you can enable it by `docker run --inspectionfs`) Signed-off-by: Akihiro Suda <[email protected]>
36579e3 to
3cf63f0
Compare
|
I don't like use of FUSE. There is no equivalent solution for non Linux OS in general. Nor do I like mounting on |
|
I really do like the idea that we have a standard place for container introspection - maybe it could be implemented as a volume plugin :) |
|
I'm 👍 for removing FUSE and just using a real filesystem #24110 (comment) I'm not sure we can mount a directory in I'll update PR when we reach consensus about the design |
I like that thought :) |
|
Seems like all of this information could be gotten from the P.S. I apologize if any of this has been previously covered and/or decided against. If that is the case please point me to the relevant discussion(s)! |
|
I once considered making that a volume plugin. I once considered the socket, but
|
Comparison (correct me if wrong 😄, last update Jul 26, 1:42 UTC)
Currently I'm +1 for FS (bind-mount), but not strongly sticking to it. I'm planning to modify the PR so as to:
I'm still not sure about:
|
|
Thanks for starting the work on this @AkihiroSuda - note that most maintainers are still very busy on the 1.12 release, but we should definitely give this attention once we have some time on our hands. Having an introspection API has been on the list of a long time, but still needed more discussion in what form; hopefully this PR (and related issue) gets the discussion going again. FWIW; we should give proper thought if this should be available by default or as an opt-in (the API can expose information that you may not want to have available in just "any" container). Also, it should be discussed if the API can be "scoped", so that only a limited subset of information is available to a container (think of multi-tenant situations). The last obviously depends on what we want to expose (e.g., "docker events" are currently used by various containers, and currently implemented by bind-mounting |
|
Windows does have the equivalent of sockets, "named pipes" which is what the Docker now uses on WIndows (it used to always use a tcp socket). |
|
|
+1 to built in volume plugin :) |
|
I'll try to rework on this as a built-in volume plugin, sorry for long delay |
|
Opened a new PR (built-in volume driver): #26331 It looks like this: |
- What I did
Provides the following files for exposing task information (especially, the task slot) to containers:
/dev/docker/container/json/dev/docker/swarm/task/json/dev/dockeris mounted by default for tasks, but not mounted for non-task containers. (you can enable it bydocker run --inspectionfs)For the story so far, please look into #24110 (comment)
ping @stevvooe @vbatts @SvenDowideit
Fix #24110
Update #23843
Update #24113
- How I did it
Used FUSE.
- How to verify it
docker service create --replicas 3 --name s1 alpine tail -f /dev/nullcat /dev/docker/container/jsonin each of task containerscat /dev/docker/swarm/task/jsonin each of task containersdocker service rm s1cat /proc/mountsDiscussion:
docker service create -e ZKID={{.Task.Slot}}Pass swarm task information as environment variables into each task #24110 (comment)docker service create --scatter=ZKID=$(seq 1 3)[Suggestion] "Indexed Job" fordocker service create#23843TODOs:
/dev/docker/swarmif the container is not a swarm taskvendor