This repository contains examples of basic Docker commands, how to write a Dockerfile, and how to use Docker Compose. It also includes hands-on exercises and practical scenarios to practice and strengthen your Docker skills.
-
Download Docker Desktop
-
Install it like a regular application
-
Verify installation:
docker --version
-
π Docker Basics
Contains examples of common Docker commands, such as:
# Display running containers docker container ls # Create docker container docker container create --name my-nginx nginx:latest # Start docker container docker container start my-nginx
-
π Dockerfile
Shows how to build custom images with Dockerfile, including:
# Use base image FROM node:18-alpine # Copy files and install dependencies WORKDIR /app COPY . . RUN npm install # Start application CMD ["npm", "start"]
-
π Docker Compose
Demonstrates how to manage multiple services using Docker Compose, such as:
version: "3.8" services: web: image: nginx ports: - "8080:80" db: image: postgres:14 environment: POSTGRES_USER: user POSTGRES_PASSWORD: pass POSTGRES_DB: mydb