Three mini-questions about Docker: what is Docker, Docker Compose, Docker Image?
sobes.tech AI
Answer from AI
Docker is a platform for building, shipping, and running applications in isolated containers. Containers allow you to package an application with all its dependencies, ensuring consistent operation across different environments.
Docker Image is a template or snapshot from which a container is created. An image contains everything needed to run an application: code, libraries, configurations.
Docker Compose is a tool for defining and running multi-container Docker applications. Using a docker-compose.yml file, you can describe multiple services, their relationships, networks, and volumes, and then start them with a single command.
Example docker-compose.yml for a web application and database:
version: '3'
services:
web:
image: myapp:latest
ports:
- "80:80"
depends_on:
- db
db:
image: postgres:13
environment:
POSTGRES_PASSWORD: example
This launches two containers: an application and a database, linked together.