Docker Introduction for beginners
Introduction
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
- 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
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
- Docker follows client-server architecture.
- 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 command: docker 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.
- 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
- 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.
0 Response to "Docker Introduction for beginners"
Post a Comment