DEV Community

Ghost
Ghost

Posted on

How do containers work when you're using both Docker and Kubernetes?

I'm new to containerisation, and have never actually used it in practise... or even used any of my developing skills in practice since I'm new to this whole 'developing' thing. I think I've got a really basic understanding of containers, but I don't understand how you'd use Kubernetes and Docker together in a workflow?

I really should have made this a like 'Explain Like I'm 5' sorta thing.

Top comments (4)

Collapse
 
dmfay profile image
Dian Fay

Docker runs containers. Kubernetes orchestrates containers. Orchestration is how you stitch multiple containers together into a greater whole: for example, you can have several application containers (and scale out to add more application containers at runtime) talking to a database container. It's possible to do this with Docker alone, but prohibitively complicated at the low level of individual containers. The language of "pods", "services", "deployments", and so on that Kubernetes employs lets you operate at the level of multiple interacting containers instead.

Collapse
 
ghost profile image
Ghost

Thanks for the reply! That really clears up everything - I thought that Kubernetes runed containers like Docker!

You are

Collapse
 
dmfay profile image
Dian Fay

To add:

You could manage a small cluster of Docker containers on one host machine with a good memory and some facility with Bash. Where orchestration really comes into its own is when you need to scale across multiple hosts.

There are other technologies that do overlap with Kubernetes, notably the combination of Docker Swarm + Docker Compose. Kubernetes has support for more complex workflows with stuff like jobs which run once and exit, while Compose is purely about describing what your cluster looks like and then making that happen.

Collapse
 
eduardort profile image
Eduardo Reyes

I know this maybe a little bit more than ELI5 but if you want to dive further, "container" don't really exist

So basically a "container" is a combination of cgroup restrictions and namespaces, kubernetes adds containers to the same namespace so that they can be called as if they where in the same localhost.

Also, kubernetes is testing support for rkt which is kind of a docker competitor on its own.

Now, kubernetes orchestrates containers, this basically means it handles them through some strategies (deployments, daemon sets, replica sets, etc).