Docker
Introduction : Docker is a platform that enables developers to build, packages, and distribute applications in lightweight, portable containers . Containers provide a consistent runtime environment, ensuring that application work the same way across different system .
Docker Engine : is a platform that provide containerization technology for building and containerizing your applications .
Benefits of Docker :
Portability : Container run the same way in development, Testing, and production environments.
Scalability : Easily scale applications with container orchestration tools like Kubernetes .
Efficiency : Uses fewer resources compared to traditional virtual machine .
Isolation : Ensures dependencies and configurations remain consistent across environments .
Installation of Docker :
For Docker Installation I am using Amazon Linux machine . Create Linux machine in AWS. Install Docker using package manager yum .
CMD : 1. sudo yum update 2. sudo yum install docker -y
After installation , verify Docker is running or path .
CMD : 1. docker -- version 2. which docker
Working with Docker
Let’s start with learning commands :
To check docker service start or not . # service docker status
To start docker service . # service docker start
To see all images in your local machine. # docker images
To find out images in docker hub . # docker search ( image name )
To create new container . # docker run -it --name (Name) (image name ) /bin/bash
To download image from docker hub . # docker pull (image name)
To start container . # docker start (container name)
To go inside container . # docker attach (container name)
To see all containers ( running and stop containers) . # docker ps -a
To see only running containers . # docker ps
To stop container . # docker stop (container name )
To delete container . # docker rm (container name )
Exit from container . # exit
To understand changes made in running docker container . # docker diff (container name )
To create a new docker image . # docker commit (container id or name ) (new image name )
To build a docker image from a Dockerfile . # docker build -t (image name ) .