Docker Engine, Storage and Networking

Docker Engine, Storage and Networking

Docker Engine

It is an open source containerization technology for building and containerizing your applications.

When you install Docker on a Linux host you're actually installing three different competence.

👉Docker Daemon

  • Is the background process that manages objects such as the images containers volumes and networks

👉REST API

  • Is the API Interface that programs can use to talk to the daemon and provide instructions

👉Docker CLI

  • Command Line Interface to perform action run destroy stop start

Below are the fundamentals of containers:-

  1. Containerization

  2. Namespace-PID

    1. Process ID

    2. Unix Timesharing/User (currently experiencing support for)

    3. Mount

    4. Interprocess Communication IPC

    5. Network

  3. cgroups

    1. Docker container

    2. CPU

    3. Memory

    4. Disk

    5. Priority

docker run --cpus=.5 ubuntu
docker run --memory=100m ubuntu

Docker Storage

It is used to store the data and image layer in the writable layer of container.

  1. Filesystem

    /var/lib/docker

    1. aufs

    2. containers

    3. image

    4. volumes

  2. Layered Architecture

    1. Base Ubuntu Layer

    2. Changes in apt packages

    3. Changes in pip packages

    4. Source code

    5. Update Entry point

FROM Ubuntu
RUN apt-get update && apt-get -y install python
RUN pip install flask flask-mysql
COPY . /opt/source-code
ENTRYPOINT FLASK_APP=/opt/source-code/app/py flask
  1. COPY-ON-WRITE

    1. Container Layer

    2. Image Layers

  2. Volumes

    1. Docker host

    2. Read Only

    3. Read write

docker volume create data_volume
  1. Storage drivers

    1. AUFS

    2. ZFS

    3. BTRFS

    4. Device Mapper

    5. Overlay

    6. Overlay2

Docker Networking

Default networks

  1. Bridge

     docker run ubuntu
    
  2. none

     docker run Ubuntu --network=none
    
  3. host

     docker run Ubuntu --network=host
    

User-defined networks

docker network create \
    --driver bridge \
    --subnet 191.45.2.0/16
    custom-isolated-network
docker network ls

Inspect Network

docker inspect create-network-architecture

Embedded DNS

mysql.connect( mysql )

That's great if you have make till here you have covered basic of docker engine, storage and networking.

If you liked what you read, do follow and any feedback for further improvement will be highly appreciated!

Thank you and Happy Learning!👏