Getting started with docker


Getting started with docker.
Getting started with docker

Welcome! We are excited that you want to learn Docker. As we know that day-to-day, Docker technology is gaining more market and more mind shares among information technology (IT) professionals accross the world.Docker tool is basically used to create, deploy, and run the applications by using containers. Through Docker DevOps, developers can pack all parts of an application like libraries and other dependencies(binaries, configuration files, scripts, jars and so on) easily and ship it out as a single package.Docker was released on 10 June 2014 and since then the Companies have adopted the tool at a remarkable rate. As rather than a virtual machine it was working as a container. Today, over 35 million applications have been shipped via Docker and over 37 billion Docker applications have been downloaded.

Introduction
Due to its overwhelming usage aceoss IT industry, the domain has been stuffed with many new and pathbreaking technologies used not only for bringing in more decisive automation but also for overcomming existing complexity.The docker initiative has been specially designed for making the containerization paradigm easier to grasp and use. docker enables the containerization process to be accomplished in a risk-free and accelerated fashion.

Docker is an open source containerization engine, which automates the packaging, shiping, and deployment of any software applications that are presented as lightweight, portable, and self-sufficient containers, that will run virtually anywhare.
Building and deploying new applications is faster with containers. Docker containers wrap up software and its dependencies into a standardized unit for software development that includes everything it needs to run: code, runtime, system tools and libraries. This guarantees that your application will always run the same and makes collaboration as simple as sharing a container image.
A Docker container is a software bucketcomprising everything necessary to run the software independently.Thare can be multiple docker containersin a single machine and containers are completely isolated from one another as well as from the host machine. It could be fluently run on x64 Linux Kernel.The docker containers has its own process space and network interface. it can also run things as root, and its own /sbin/init, which can be different from the host machine.
The Docker Hub is a fast-growing repository of the docker images that can be combined in different ways for producing publicly findable, network-accessible, and widely usable containers.

Docker on linux
If we talk about docker on linux then firstly come in the mind can i run docker directly on your pc or laptop? so, my answer is Yes! Does not matter what you have operating system you can also run it on windows machine.Let's we want to directly run the containers on a linux machine. The docker engine produces, monitors, and manages multiple contaoners as illustrated in the picture.

[caption id="attachment_1556535" align="alignnone" width="300"]container-container image credit:docker.com[/caption]
As we seen in the pictur these applications cloud fluently run on converged, federated, virtualized, shares, dedicated, and automated infrastuctures.

Difference between containerization and virtualization
The following points given below gives a direct comparision between virtual machines and containers:
Virtual Machine(VMs):
1.Represents hardware-level virtualization.
2.Heavyweight.
3.Slow provisioning.
4.Limited performance.
5.Fully isolated and hence more secure.

Containers:
1.Represents operating system virtualization.
2.Lightweight.
3.Real-time provisioning and scalability
4.Native performance.
5.Process-level isolation and hence less secure.

[caption id="attachment_1556567" align="alignnone" width="300"]container-and-virtual-box image credit:docker.com[/caption]

Installing the docker engine
The installation part has taken from docker documentaion
The docker engine is built on top of the Linux kernel and it extensively leverages its features. Therefore, at this point in time, the Docker engine can only be directly run on Linux operating system distributions.Nonetheless, the Docker engine could be run on the Mac and Microsoft Windows operating systema by using the lightwaeight Linux VMs with the help of adapter, such as Boot2Docker.

Uninstall old versions


Older versions of Docker were called


  • docker, docker.io, or docker-engine


  • . If these are installed, uninstall them:




  • $ sudo apt-get remove docker docker-engine docker.io containerd runc


  • It’s OK if apt-get reports that none of these packages are installed.

    The contents of /var/lib/docker/, including images, containers, volumes, and networks, are preserved. The Docker Engine - Community package is now called docker-ce.

    Supported storage drivers


    Docker Engine - Community on Ubuntu supports overlay2, aufs and btrfs storage drivers.

    Install using the repository


    Before you install Docker Engine - Community for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.
    Set up the repository
    1.Update the apt package index:

    $ sudo apt-get update

    2.Install packages to allow apt to use a repository over HTTPS:


  • $ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common


  • 3.Add Docker’s official GPG key:


  • $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

  • Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.



  • $ sudo apt-key fingerprint 0EBFCD88


  • pub rsa4096 2017-02-22 [SCEA]
    9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
    uid [ unknown] Docker Release (CE deb)
    sub rsa4096 2017-02-22 [S]
    Use the following command to set up the stable repository. To add the nightly or test repository, add the word nightly or test (or both) after the word stable in the commands below.
    $ sudo add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) \
    stable"

    Install Docker Engine - Community
    1.Update the apt package index.


  • $ sudo apt-get update

  • 2.Install the latest version of Docker Engine - Community and containerd, or go to the next step to install a specific version:



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


  • To install a specific version of Docker Engine - Community, list the available versions in the repo, then select and install:
    a. List the versions available in your repo:


  • apt-cache madison docker-ce

  • b. Install a specific version using the version string from the second column, for example, 5:18.09.1~3-0~ubuntu-xenial


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


  • 4.Verify that Docker Engine - Community is installed correctly by running the hello-world image.


  • $ sudo docker run hello-world


  • This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.


    Install from a package
    If you cannot use Docker’s repository to install Docker Engine - Community, you can download the .deb file for your release and install it manually. You need to download a new file each time you want to upgrade Docker.

    Go to https://download.docker.com/linux/ubuntu/dists/, choose your Ubuntu version, browse to pool/stable/, choose amd64, armhf, arm64, ppc64el, or s390x, and download the .deb file for the Docker Engine - Community version you want to install.

    after downloading Traverse your path where you have dowloaded for example cd /Download.
    use ls command for list the dpkg file also check file permission is it executable or not if it is note executable then use chmod +x package_name.deb then press enter again see it it executable you will got difference from downloaded file.

    Install Docker Engine - Community, changing the path below to the path where you downloaded the Docker package.



  • $ sudo dpkg -i /path/to/package.deb


  • The Docker daemon starts automatically.

    Verify that Docker Engine - Community is installed correctly by running the hello-world image.


  • $ sudo docker run hello-world


  • This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.








    Post a Comment

    0 Comments