Fri, March 23, 2018 Β· 3 min read

Getting started with Docker part 1

Getting started with Docker part 1

Docker is a container technology built on runC, a container runtime that implements their specification and serves as a basis for other higher-level tools.

Docker consists of Docker engine a open source containerization technology & Docker Hub a SaaS from to store or share your docker images.

Docker engine: Is basically a client-server application with

  • server called β€œdockerd” responsible for running docker process (Each container is nothing but a process these are isolated using linux namespaces)
  • API access: REST API access that can be used by other programs to talk with dockerd daemon.
  • Interface: A cli interface command line utility docker.

Container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it.

Containers share same kernel as the host operating system, due to this reason containers can be setup and started with in few seconds of time as compared virtual machines.

Docker container runtime includes containerd integrated with runC to provide better functionality, containerd is used in docker, kubernetes and other container platforms.

docker can be installed on linux distributions from package managers like dnf, rpm, apt, aur or following instructions from docker site.

$sudo dnf -y install dnf-plugins-core

$ sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo

$sudo dnf install docker-ce
$sudo systemctl enable docker
$sudo systemctl start docker
$sudo usermod -aG docker $USER
$newgrp docker
$docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

docker daemon is available to access for root user only, to allow user to access docker daemon, add user to docker group.

$docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

When you want to run a container docker will look for the image on the local system if the image is available it will create a container using the image and run. Or docker will pull the image from the docker public registry then starts a container.

$docker run -itd centos /bin/bash
Unable to find image 'centos:latest' locally
latest: Pulling from library/centos
5e35d10a3eba: Pull complete
Digest: sha256:dcbc4e5e7052ea2306eed59563da1fec09196f2ecacbe042acbdcd2b44b05270
Status: Downloaded newer image for centos:latest

We need a docker account to access the repository of images also to push our images to our docker hub account.

$docker login
Login with your Docker ID to push and pull images from Docker Hub.
Username: pawaanv
Password:
Login Succeeded

Docker service can be checked from systemctl command.

#sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2018-03-25 17:21:47 IST; 5min ago
     Docs: https://docs.docker.com
 Main PID: 1164 (dockerd)
    Tasks: 21
   Memory: 119.3M
      CPU: 2.227s
   CGroup: /system.slice/docker.service
           β”œβ”€1164 /usr/bin/dockerd
           └─1575 docker-containerd --config /var/run/docker/containerd/containerd.toml