Docker Introduction for beginners

Introduction
  • Docker is a developer tool released in 2013 by docker team.
  • It is a centralized platform to execute your application.
  • It is a facility to run applications in an isolated environment.
  • Using docker we can build, ship and run any app.
  • It is very similar to virtual machine concept.
  • Docker fallows client-server architecture.
Architecture

Architecture
Installation
To install docker in windows machines:https://docs.docker.com/docker-for-windows/install/
                                        (or)

Install the Docker tool Box: https://docs.docker.com/toolbox/toolbox_install_windows/

Components

  1. Docker follows client-server architecture.
  2. Docker has three main components those are 

                               Docker CLI (command line interface)
                               Docker host(Docker daemon )
                               Registry(Repository) 
Pull and push images
  • To pull the image from the docker hub uses the following commanddocker pull (image name: tag name).
  • To push the image into docker hub(registry ) first tag the image to the repository and then push into the docker hub. 
  • Docker tag image-id yourdhubname/repo name: tag name 
  • docker push yourdhubname/repo name
 Docker-file
  • It is the main part of your docker image, based on this file application will package to image. 
  • Docker files have no extensions.
  • Use the predefined commands to package the application provided by docker.
  • FROM ,COPY ,CMD,MAIN,MAIN-CLASS etc.
  • From: Define the base image used to start the build process. for java applications build to use OpenJDK:8
  • Add: Copy the source file into the container. Here I Added the targeted the jar file and second argument as a jar file name as which you want to name it.
  • Expose: Expose the port number to a web application. (binding the port into an application)
  • Entry point: Set a default application to be used every time a container is created with the image.
Managing Containers
  • The container is an instance of images. These are continuously running on docker daemon.
  • We can manage the container using the commands to stop and start and remove the containers.
  • Every container has one unique id so we can easily identify which container to stop and start.
  • To start the container using the following command: docker start imageid.
  • To stop the container using the following command: docker stop imageid.
  • To remove the container using the following command: docker rm imageid. 
Useful Commands
  • Docker ip:docker-machine IP
  • Docker running process: docker ps and docker ps -a
  • Docker images: docker images
  • Pull image: docker pull image name:tag name
  • Run image:docker run imageName
  • Remove image:docker rmi imageId
  • Build the image: docker build -t tag-name.
  • Tag image: docker build tag imageid hub name/repo name: tag name
  • Push image: docker push hubname/repo
Conclusion
  • Open source and easily configurable.
  • Lightweight and Very fast to deploy the applications into containers.
  • Sharing applications are easy to process.
  • Run the multiple containers at a time.
  • Deploy applications any platform and run the application anywhere.
  • Less CPU utilization.
  • Less memory occupancy.

SUBSCRIBE TO OUR NEWSLETTER

I’m the Founder of quickdevops.com. I am a Professional Blogger, Application developer, YouTuber. I’ve been blogging since 2015.I spend a lot of time learning new techniques and actively help other people learn web development through a variety of help groups and writing web development tutorials for my website and blog about advancements in web design and development.Besides programming I love spending time with friends and family and can often be found together going out catching the latest movie or planning a trip to someplace I've never been before.

0 Response to "Docker Introduction for beginners"

Post a Comment