Docker
Introduction
Docker is a platform for developing, shipping, and running applications in containers.
Key Concepts
Containers
Containers are lightweight, standalone packages that include everything needed to run an application.
Images
Docker images are read-only templates used to create containers.
Dockerfile
A text file containing instructions to build a Docker image.
Basic Commands
# Pull an image
docker pull nginx
# Run a container
docker run -d -p 80:80 nginx
# List running containers
docker ps
# Stop a container
docker stop <container_id>
Best Practices
- Use official base images
- Minimize layers in Dockerfile
- Use .dockerignore file
- Don't run as root