What is Docker?
Docker is a container management tool or software platform that allows you to build, test and deploy applications quickly.
Why We need docker?
It reduces the cost
It saves time as it deploys code quickly
It improves software quality
What is Container?
A container is a standard unit of software that packages up code and all its dependencies, so the application runs quickly and reliably from one computing environment to another
How Container Works?
It is a runnable instance of an image. You can create, start, stop, move, or delete a container
How to install Docker?
Step 1 – Download and Run the script.
$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
Step 2 – Enable Docker
$ sudo systemctl enable docker
Step 3 – Start Docker
$ sudo systemctl start docker
Step 4 – Verify that docker is installed correctly by running the hello-world image.
$ sudo docker run hello-world
What are the components docker?
What is a container lifecycle commands?
Docker create “docker name”
Docker start “container id”
Docker restart “container id”
Docker pause “container id”
Docker unpause “container id”
Docker stop “container id”
Docker kill “container id”
Docker stats “container id”
Docker rm “container id”
What is docker pause/unpause?
Docker pause is used to pause the session which are not active currently to save CPU resources
Docker unpause command is used to unpause the session which is paused currently to resume the session
What is docker stop/kill?
Docker stop will end the session with Exit (0) code and it stops container gracefully
Docker Kill will terminate the session abruptly with Exit (137) code
How to get inside a container?
docker run -it -d ubuntu /bin/bash
docker run -itd ubuntu /bin/bash
docker exec 955a249cbf71 ls
docker exec 955a249cbf71 ps -eaf
docker exec -it 955a249cbf71 /bin/bash
How to access container from outside?
docker inspect 955a249cbf71
What is the rule for container is running?
Attached to a terminal of PID1 of the container. PID changes