What is Docker?
Docker is an open-source platform that allows developers to build, package, and run applications in isolated environments called containers. This technology simplifies application management and dependencies, ensuring consistency between development and production environments.
1. Docker Basic Concepts
a. Container
A container is an isolated unit that runs an application along with its dependencies. Unlike virtual machines (VMs), containers share the host kernel, making them more lightweight and efficient.
b. Image
An image is a template used to create a container. Images are read-only and can be distributed through Docker Hub or other registries.
2. Basic Docker Commands
a. Running a Docker Container
docker run -d --name my_container nginx
This command runs a container based on the nginx image in detached mode.
b. Viewing Running Containers
docker ps
Displays a list of currently running containers.
c. Stopping a Container
docker stop my_container
Stops the container named my_container.
d. Removing a Container
docker rm my_container
Deletes a stopped container.
e. Pulling an Image from Docker Hub
docker pull ubuntu
Pulls the ubuntu image from Docker Hub.