Install Docker on AWS EC2 Instance & Some basic commands of Docker
1. What is Docker & why it is used..?
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.
2. Step to Install Docker on Ubuntu OS
1. Launch EC2 Instance with Ubuntu AMI
2. Login With EC2 Instance and update your machine
apt-get update
3. Now Install Docker on your machine
apt install docker.io
#or
yum install docker -y
4. Now Install Docker-Compose
1. apt install docker-compose
2. systemctl start docker
3. systemctl status docker
3. Now Docker is Install now we see some basic commands of docker for daily uses.
1. To see all images present in your local machine
docker images
2. To find out particular image in docker for e.g. we’ll search Ubuntu Image
docker search ubuntu
3. To download image from docker hub to local machine e.g. Ubuntu
docker pull ubuntu
4. How to give name to container
docker run -it --name "container-name" ubuntu /bin/bash (Ubuntu is Image name)
#i = interactive mode
#t = terminal
5. How to check docker start or not
service docker status
#or
docker info
6. To start container
docker start "container-name"
7. To go inside container
docker attach "container-name"
8. To see all container
docker ps -a
9. To see only running container
docker ps
#ps = Process Status
10. To stop container
docker stop "container-name"
11. To delete container
docker rm "container-name"
12. If you see which docker OS is running on your machine
#Firstly run container & go to in the container
cat /etc/os-release
13. If you want quit the container or exit from container
exit