Day 16: Docker for DevOps Engineers.(Part-01)

  1. What is Docker?

Docker is a powerful containerization tool widely used in DevOps. It is an open-source platform used for packaging, distributing, and running applications within containers. Docker enables developers to package applications and their dependencies into standardized units called containers, which can then be easily deployed across different platforms such as Linux, macOS, and Windows. Containers created with Docker are lightweight, portable, and provide consistent environments for applications to run, making it easier to develop, deploy, and manage software applications across various environments.

  1. Why do we use Docker?

    Docker is widely used for its ability to simplify the process of packaging, distributing, and running applications within containers. Containers offer a lightweight, portable, and consistent environment for applications to run, which brings several benefits:

    1. Consistency: Docker ensures consistency across different environments, allowing developers to build applications once and run them anywhere. This reduces the risk of issues arising from differences in development, testing, and production environments.

    2. Isolation: Containers provide isolation for applications and their dependencies, preventing conflicts between different software components. Each container encapsulates the application and its dependencies, ensuring that changes made to one container do not affect others.

    3. Efficiency: Docker containers are lightweight and share the host operating system's kernel, resulting in faster startup times and reduced resource overhead compared to virtual machines. This enables efficient resource utilization and scalability.

    4. Portability: Docker containers can be easily moved between different environments, such as development, testing, and production, without modification. This simplifies the process of deploying and scaling applications across different infrastructure platforms.

    5. Versioning and Rollback: Docker allows for versioning of container images, making it easy to track changes and roll back to previous versions if needed. This provides greater control and reliability in managing application releases.

Example: Suppose a development team is building a web application using Docker. They can create separate containers for the application server, database, and any other components. Each container is built with the necessary dependencies and configurations, ensuring consistency across development, testing, and production environments. Developers can easily share and collaborate on containerized applications, and operations teams can deploy and scale them efficiently using Docker's management tools. Overall, Docker simplifies the software development lifecycle and improves collaboration between development and operations teams.

  1. Step-by-step process for installing Docker in Ubuntu.

To install Docker on Ubuntu, you can follow these step-by-step instructions:

  1. Update the apt package index:

     sudo apt update
    
  2. Install the packages necessary to allow apt to use a repository over HTTPS:

     sudo apt install apt-transport-https ca-certificates curl software-properties-common
    
  3. Add Docker’s official GPG key:

     curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
  4. Verify that the key fingerprint is correct:

     sudo apt-key fingerprint 0EBFCD88
    
  5. Add the Docker repository to the system's software sources:

     sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    
  6. Update the apt package index again:

     sudo apt update
    
  7. Install the latest version of Docker CE (Community Edition):

     sudo apt install docker-ce
    
  8. Docker should now be installed. You can verify it by checking the Docker version:

     docker --version
    
  9. Optionally, you can run the hello-world container to verify that Docker is working correctly:

     sudo docker run hello-world
    

That's it! Docker should now be successfully installed on your Ubuntu system. You can start using Docker to manage containers.

10
Subscribe to my newsletter

Read articles from Yashraj Singh Sisodiya directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Yashraj Singh Sisodiya
Yashraj Singh Sisodiya

I am Yashraj Singh Sisodiya, a 3rd Year CSE student at SVVV, born and raised in Shujalpur. Currently residing in Indore, I'm passionate about pursuing a career in DevOps engineering. My tech journey began with an internship at Infobyte, honing my skills as an Android Developer intern. Alongside my academic pursuits, I actively participate in co-curriculars, holding roles as Technical Lead at Abhyudaya and Cloud Lead at GDSC SVVV, while also serving as an MLSA of my college. I have a keen interest in Cloud Computing, demonstrated through projects such as User management and Backup using shell scripting Linux, Dockerizing applications, CI/CD with Jenkins, and deploying a 3-tier application on AWS. Always eager to learn, I'm committed to expanding my knowledge and skills in the ever-evolving tech landscape.