4.1 Docker the program
parent
2c807bee6d
commit
adc1f4b1c0
|
@ -0,0 +1,41 @@
|
||||||
|
# 4. Under the Hood
|
||||||
|
|
||||||
|
## Docker the program
|
||||||
|
|
||||||
|
### What Kernels Do
|
||||||
|
|
||||||
|
* software core of computer
|
||||||
|
* Run directly on hardware, had many jobs
|
||||||
|
* Respond to messages from the hardware
|
||||||
|
* Start and schedule programs
|
||||||
|
* Control and organize storage
|
||||||
|
* Pass messages between programs
|
||||||
|
* Allocate resources, memory, CPU, network, etc
|
||||||
|
* **Create containers by Docker configuring the kernel**
|
||||||
|
|
||||||
|
### What Docker Does
|
||||||
|
|
||||||
|
* Program written in Go
|
||||||
|
* Manages kernel features
|
||||||
|
* Docker uses "cgroups" to contain processes, so each container (with its process) is isolated
|
||||||
|
* Docker uses "namespaces" (feature of Linux Kernel) to contain networks
|
||||||
|
* USes "copy-on-write" filesystems to build images
|
||||||
|
* Above features has been used by industry for years before Docker.
|
||||||
|
|
||||||
|
### What Docker Really Does
|
||||||
|
|
||||||
|
* Makes scripting distributed systems "easy"
|
||||||
|
|
||||||
|
### The Docker Control Socket
|
||||||
|
|
||||||
|
* Docker is two programs: a **client** & a **server**
|
||||||
|
* They communicate via a socket
|
||||||
|
* The server receives commands over a socket (either over a network or through a "file")
|
||||||
|
* When client & server are on same computer, a special "file" `socket` is created for communication
|
||||||
|
* The client can even run inside a docker container itself
|
||||||
|
|
||||||
|
location of docker socket file on linux: `/var/run/docker.sock`
|
||||||
|
|
||||||
|
We can control the docker server using docker client inside a container: `docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock docker sh`
|
||||||
|
|
||||||
|
##
|
Loading…
Reference in New Issue