What is Docker
-
Docker is one of container implementation. Others are Rocket, Drawbridge, LXC.
Docker Inc. is the company that sells the commercial version of Docker. Docker is also available as open source.
Docker Daemon / dockerd? Manages Docker objects(Eg: Images, containers, networks, and volumes). dockerd also communicate with other daemons to manage Docker services.
Docker client / docker? Users interact with docker client.
User
$ docker run -----> [Docker Client] -----> [Docker Daemon/dockerd]
Docker vs Kubernets
| Docker | Kubernetes(Container Orchestration system) | |
|---|---|---|
| What | Platform for building containers | Platform for managing multiple containers |
| Use case | Run containers on 1 host | Run containers on cluster of machines, providing scaling, self-healing, and rollback |
| Commands | docker run | helm |
Docker Networking
-
Connecting Docker Containers with each other and with outside world.
Types of Docker Networking
| Network | Description | ||||||
|---|---|---|---|---|---|---|---|
| Bridge Networking |
Used when multiple containers want to communicate on the same Docker host. Types of Bridges:
Run 2 different Alpine containers on same docker host and commmunicate between them
|
||||||
| None Networking |
This completely disables the networking stack on the container. Within the container, only the loopback device is created
Example:
|
||||||
| Host Networking |
Container's network stack is same as host network stack. IP Address of container is same as host OS.
Useful in situtation where container needs to listen/read/write on large number of ports. Advantages 1. Expose 1 port and IP access the service. Example: 50 Game servers are running in Docker containers on same host. Requests are routed using kubernets to free game server. Disadvantages: Host networking driver only work on linux not on Windows and MAC. Example: Nginx container binds directly to port 80 on the Docker host: Start ngnix in container with host networking, ngnix listens on port 80 which is same as docker host.
|