Open source platform that automatesmthe deployment, scaling and management of applications using containerization technology.
Containers
- Lightweight, standalone, executable packages that include everything needed to run a piece of software
- Include the code, runtime, system tools, libraries and settings
- Consistent environment across different development and production systems
Images
- Read only templates used to create containers
- Often based on other images with additional customization
- Defined in a Dockerfile
Dockerfile
- Text file that contains instructions to build a docker image
- specifies base image, adds files, installs dependencies, sets environment variables
Basic Docker Commands
# Build an image
docker build -t myimage .
# Run a container
docker run -d -p 8080:80 myimage
# List running containers
docker ps
# Stop a container
docker stop container_id
# Remove a container
docker rm container_id
# List images
docker images
# Remove an image
docker rmi image_id
Benefits of Using Docker
- Consitency across environments
- Isolation and security
- Quick deployment and scaling
- Version control and component reuse
- Simplified configuration