Skip to content

Containerd integration#20662

Merged
jessfraz merged 5 commits intomoby:masterfrom
tonistiigi:containerd-integration
Mar 19, 2016
Merged

Containerd integration#20662
jessfraz merged 5 commits intomoby:masterfrom
tonistiigi:containerd-integration

Conversation

@tonistiigi
Copy link
Member

fixes #11529
fixes #20361
fixes #2658

This removes docker execdrivers and implements container execution on top of containerd. containerd is a daemon for controlling
runc, or any executor compatible with the oci spec.

One of the ux changes with this is that containers will not die when the docker daemon(or containerd) crashes. In the future this will the daemon you should be able to reattach to containers. Currently this feature is only enabled for the experimental build.

If no path to containerd is specified docker will launch the containerd daemon for you.

If you build/test manually without the Dockerfile context you will need containerd, containerd-shim and runc binaries. Please refer to the Dockerfile for the current versions as they contain some hotfixes atm. If you build with Dockerfile(or user our package in the future) then everything should be set.

Implementation:

  • daemon/oci* - manages the creation of oci bundles from docker data structures.
  • oci/* - Helper pkg for making oci specs.
  • libcontainerd/* - Package for interacting with containerd api.

TODO/Known issues(please report more):

  • Different /sys mount rule for --privileged
  • Handling of events that happened while docker was down
  • Setting custom user to docker exec process
  • User resolution by name from container rootfs
  • docker exec --privileged (needs oci/runc implementation)
  • docker exec -t with userns (permission denied) (containerd)
  • docker update (needs containerd implementation)
  • masked paths (runc)
  • readonly paths (runc) / readonly remounts on readonly rootfs
  • oom handling (containerd)
  • WINDOWS SUPPORT

daemon/config.go Outdated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this also be a path to a UNIX socket? If so, the description should mention that as well.

@tonistiigi tonistiigi force-pushed the containerd-integration branch from 9f8049c to 008e234 Compare February 24, 2016 17:51
daemon/daemon.go Outdated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need a closure here.

@tonistiigi tonistiigi force-pushed the containerd-integration branch from 008e234 to 02b1fbc Compare February 24, 2016 17:57

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errors should start with lowercase. Same applies to other functions in this file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These errors (and the one in daemon/daemon) are carried over from execdriver codebase. They probably should be changed with a PR that only changes that.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same interface is defined in the restartmanager package. Could one package import the other to avoid the duplicate definition?

@coolljt0725
Copy link
Contributor

Amazing work 👍 and I have tested this, it's really awesome.

This make daemon hot upgrade possible and make engine with high availability. I think this also need the libnetwork to restore the old running container network settings. I create an issue #moby/libnetwork#975. I make some progress to support this https://github.com/coolljt0725/docker/tree/containerd-integration-network, it can work.

@icecrime
Copy link
Contributor

Ping @chanwit: I know you've been experimenting with containerd and we'd love to have your feedback!

@tonistiigi tonistiigi force-pushed the containerd-integration branch from d70d16b to d03404e Compare February 26, 2016 19:22
@chanwit
Copy link

chanwit commented Feb 26, 2016

This is wonderful.

Read the code and not sure I'm understanding it correctly.

This PR is replacing the execdriver with containerd, but I am expecting containerd to be working in parallel with the current implementation.

WDYT?

@tonistiigi
Copy link
Member Author

@chanwit There is a --containerd= option in the daemon if you want to use external containerd. If not then docker will start one for you(and shut down if needed).
edit: you probably meant "parallel with current execdriver implementation". Execdrivers are supposed to be replaced by different oci compliant binaries.

@icecrime icecrime added this to the 1.11.0 milestone Feb 27, 2016
docker/daemon.go Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we return if the error is not nil? if the error is not nil, the containerdRemote will nil, this will make the following d, err := daemon.NewDaemon(cli.Config, registryService, containerdRemote) failed with crash, because d.containerd, err = containerdRemote.Client(d) in NewDaemon will failed with panic: runtime error: invalid memory address or nil pointer dereference. A easy way to reproduce this is not install containerd in $PATH

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct, will fix

@chanwit
Copy link

chanwit commented Feb 28, 2016

@tonistiigi Maybe I couldn't explain it clearly. What I meant is that execdriver and containerd are at the different abstraction.

execdriver is the umbrella for both libcontainer (native) and containerd for example.
To make it has both direct libcontainer implementation along with containerd, maybe it's better to have this containerd patch being under the execdriver rather than replacing it.

@thaJeztah
Copy link
Member

W00000000t! Great work all!

@WeiZhang555
Copy link
Contributor

Congratulations! 🎆

@jakirkham
Copy link

🎉

@aaronlehmann
Copy link

Congrats!

@vdemeester
Copy link
Member

🎉

@runcom
Copy link
Member

runcom commented Mar 19, 2016

😺

@coolljt0725
Copy link
Contributor

congrats! ㊗️

@jmeyo
Copy link

jmeyo commented Mar 19, 2016

gg, hope migration/update will be smooth

@luxas
Copy link

luxas commented Mar 19, 2016

Does this require runc and containerd pre-installed on the host now, before the daemon is usable?
Or do you bundle them together in some way?
Thinking about ARM support and kubernetes-on-arm

@mlaventure
Copy link
Contributor

@luxas Yes it does.

However, the docker packages will bundle all necessary binaries. So if you're using our packages they'll be automatically installed.

If you build directly from master, you can copy the generated binaries from the image generated by make build or build your own using the same commands that can be found in the Dockerfile.

@kencochrane
Copy link
Contributor

I'm currently working on a follow up PR that will be adding the binaries to the packages.

I'll also be working on adding all of the binaries to the tar files that we provide so that you will be able to download a tar bundle with all required binaries.

@Hokutosei
Copy link

congrats! amazing work!

@HackToday
Copy link
Contributor

hi @tonistiigi or other docker maintainers, since related docker contribution docs not updated. I tried

root@bf86488287ac:/go/src/github.com/docker/docker# cp bundles/1.11.0-dev/binary/docker /usr/bin/
root@bf86488287ac:/go/src/github.com/docker/docker# docker daemon -D
DEBU[0000] docker group found. gid: 999
DEBU[0000] Listener created for HTTP on unix (/var/run/docker.sock)
FATA[0000] Failed to connect to containerd. Please make sure containerd is installed in your PATH or you have specificed the correct address. Got error: exec: "containerd": executable file not found in $PATH

Do I need to download containerd and install on my test container env ?

@coolljt0725
Copy link
Contributor

@cyphar
Copy link
Contributor

cyphar commented Mar 21, 2016

@tonistiigi

Do you mind if I ask why the other execdriver was purged in a single minor version release of Docker? LXC died after at least 2 years of support, and now we've nixed libcontainer in a single patchset? I don't understand the reasoning behind such a sudden switch, it's bordering on harmful (containerd is listed as "alpha quality software" -- so now distributions have to package self-proclaimed alpha quality software in order to keep up with upstream!). I mean, the 1.10 image manifest migration wasn't great either, but come on, we're better than this.

@HackToday
Copy link
Contributor

hi @coolljt0725 and @tonistiigi I am not sure if it is good practice for that, I assume if we introduce such change, it would be better to add developer support, like
https://docs.docker.com/opensource/project/set-up-dev-env/
should keep updates in master branch, we means, developers can know what special build to do and what special binary need to install with.

To me, it seems not friendly to developers. Unless I miss something in master branch doc.

@WeiZhang555
Copy link
Contributor

@HackToday

I think they are working on docs, it should come soon I guess.

#20662 (comment)

Documentation will come in a followup PR as agreed with @thaJeztah.

@HackToday
Copy link
Contributor

I have removed old built image dry-run-test. and run docker build -t dry-run-test . again, and find that image can work now, start docker, and docker would start containerd by itself. Maybe it was old image issue, but anyway, it would be better to have a doc related about containerd, how docker call it etc, which could help more devlopers to understood and debug. Thanks

@icecrime
Copy link
Contributor

@cyphar We're not removing libcontainer, we're adding a new process boundary in between. Containerd is obviously not alpha anymore, but you're right we should update the README accordingly.

@cyphar
Copy link
Contributor

cyphar commented Mar 22, 2016

@icecrime Correction, 3 process boundaries (containerd, containerd-shim and runc). The point is that the native execdriver has been removed in a single minor version release -- that's not how stable software operates. You don't just rip out a subsystem in a single release.

@icecrime
Copy link
Contributor

@cyphar Can you please explain what is the user-facing breaking change?

@cyphar
Copy link
Contributor

cyphar commented Mar 22, 2016

For package maintainers, we now have to maintain 2 more packages (containerd and runc) which have non-trivial interactions between each other. Sure, users won't notice anything happen unless the new and shiny (three) levels of indirection break (which will happen). The issue is that if someone wants to use 1.11, but containerd breaks, there's no recourse to use the old native execdriver. I'm also not convinced of the perceived benefits, but that's a separate issue.

Also, "what is the user-facing breaking change" is not the only relevant question. There are also questions about maintainability that need to be considered before core components are removed.

@dqminh
Copy link
Contributor

dqminh commented Mar 22, 2016

I was hoping that we could retain the execdriver abstraction too at least for 1 release so we can roll this out and test it slowly on a few applications instead of having to test it on a few nodes.

User will not see any changes, but operators of large cluster probably will :p

@moby moby locked and limited conversation to collaborators Mar 23, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Containerd Integration Evented Process Monitor Upgrade daemon without restarting containers