42

I started learning about Docker. But I keep getting confused often, even though I read it in multiple places.

Docker Host and Docker Container.

  • Docker Engine is the base Engine that handles the containers.
  • Docker Containers sit on top of Docker engine. This is created by recipes (text file with shell script). It pulls the image from the hub and you can install your stuff on it.
  • In a typical application environment, you will create separate containers for each piece of the system, Application Server, Database Server, Web Server, etc. (one container for each).
  • Docker Swarm is a cluster of containers.

Where does the Docker Host come in? Is this another word for Container or another layer where you can keep multiple containers together?

Sorry may be a basic question. I googled this, but no use.

Kevin Rave
  • 13,876
  • 35
  • 109
  • 173

5 Answers5

32

The docker host is the base traditional OS server where the OS and processes are running in normal (non-container) mode. So the OS and processes you start by actually powering on and booting a server (or VM) are the docker host. The processes that start within containers via docker commands are your containers.

To make an analogy: the docker host is the playground, the docker containers are the kids playing around in there.

Peter Lyons
  • 142,938
  • 30
  • 279
  • 274
  • This analogy isn't helping me understand port mapping. I understand the kids have ports, and the playground can have ports to contact things outside the playground, but why would the playground need ports to access the kids' ports? – Mike B Apr 19 '22 at 21:47
  • @MikeB There are 11 kids on the playground at recess in Mr. Peters class. A parent comes to the school and delivers a message for Bobby. Mr. Peters hands the message to Bobby. Parent=TCP message from the internet. Teacher=Host. Student=Container. – P.Brian.Mackey Aug 30 '23 at 01:50
  • It is interesting to note that in a compose.yaml there is even more ambiguous terminology. A container port is referred to as a target and the host port is called published. Perhaps this is because hosts can be load balanced? Still, I find it odd. https://docs.docker.com/compose/compose-file/compose-file-v3/#long-syntax-1 – P.Brian.Mackey Aug 30 '23 at 02:26
20

Docker Host is the machine that Docker Engine is installed.

Gomex
  • 418
  • 2
  • 7
16

Here's a picture, which I find easier to understand than words. I found it here.

The Host is the machine managing the containers and images, where you actually installed Docker.

enter image description here

Sean McCarthy
  • 4,838
  • 8
  • 39
  • 61
3

Docker host is the machine where you installed the docker engine. the docker container can be compared with a simple process running on that same docker host.

UserASR
  • 2,015
  • 4
  • 24
  • 47
2

The Host is the underlying OS and it's support for app isolation (ie., process and user isolation via "containers." Docker provides an API that defines a method of application packaging and methods for working for the containers.

Host = container implementation Docker = app packaging and container management

paul stanton
  • 936
  • 7
  • 7