libcontainer vs Docker vs OCF vs runc?

2020-06-02 17:19发布

问题:

I'm trying to understand the Docker world a little better, and can't quite seem to wrap my brain around the differences between these. I believe that OCF is an emerging container standard being endorsed by OpenContainers, and I believe that Docker is set to be the first reference implementation of that standard. But even then, I have concerns that the Google Gods don't seem to be providing answers for:

  • What exactly is the OCF "standard"? Just a written document? A written API? A compiled C lib?
  • What are some examples of specific items governed by this standard? I guess without really understanding what a "container" is, its hard for me to understand what a governing standard for containers even addresses.
  • How/where do runc and libcontainer fit into the Docker/OCF equation?

回答1:

The Open Container Format (OCF) specification is a written document (or set of documents) defining what a "standard container" is, in terms of filesystem, available operations and execution environment. The document seems to be backed up with Go code. This specification is currently (July 2015) a work-in-progress.

Runc is an implementation of the standard. At the time of writing, it is basically a repackaging of libcontainer.

Docker uses libcontainer/runc, but adds a lot of tooling and features on top, such as volumes, networking and management of containers.

There is more information on the Docker blog and Open Containers site.

If you're just getting started with containers, I would start with Docker and look into the other projects later once you understand how containers work.



回答2:

Just in case anyone accidentally finds comes across this old thread like I just did: this specification is no longer called OCF, it is now known as the "Open Container Initiative Runtime Specification", the link above still works though it now sends you to https://github.com/opencontainers/runtime-spec. There is a different OCF spec around (Open Connectivity Foundation).