Hands on with Docker from scratch


Docker is a containerization tool. It creates, manages and maintain the containers. It is a lightweight container orchestration tool. It’s easy to deploy an applications with in containers and offers fast way of application execution, efficient way to build, Interoperability and multiple OS level abstraction.

Steps for Docker installation in Ubuntu
Update the packages command :

$ sudo apt-get update 
$ sudo apt-get install \   
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Adding Docker official GPG key [1]

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Set up the stable repository x86_64 / amd64

$ echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Docker engine installation with latest version, including containerd

$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io

Successfully execution of below commands considers as Docker engine installed correctly

$ sudo docker run hello-world

Below are some basic commands, for pull, run and remove Docker containers.
Pull Docker image for Docker Hub:

$ Docker pull <Docker-image-name> 

List all images

$ Docker images ls

Remove Docker image

$ Docker rm <Docker-image-name> 

Create a container from images

$ Docker run <Docker-image-name> 

List all running containers

$ Docker ps -a

Remove Docker image and running container

$ Docker rmi <Docker-image-name> 
$ Docker rm <Docker-container-id>

Awesome, you have hands on with Docker. Moving forward, you can try many other commands [1]

Leave A Comment

Your email address will not be published. Required fields are marked *