Skip to content

Commit cbf43ef

Browse files
committed
v0.5
1 parent 13a7437 commit cbf43ef

12 files changed

Lines changed: 4312 additions & 3898 deletions

assets/css/main.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,8 +744,10 @@ kbd,
744744
pre,
745745
samp {
746746
font-family: var(--font-jetbrains), ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
747-
font-size: 0.810rem;
747+
font-size: 0.835rem;
748748
line-height: 1.250rem;
749+
white-space: pre;
750+
overflow-x: scroll;
749751
}
750752

751753
pre.shiki,

references.json

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"title": "Rust",
5454
"filename": "rust_reference.rs",
5555
"language": "rust",
56-
"new":true,
5756
"meta": {
5857
"title": "Rust Reference: Comprehensive Developer's Guide",
5958
"description": "Rust Guide covering basic to advanced concepts, including data types, ownership, concurrency, lifetimes, macros and more for building robust applications.",
@@ -64,7 +63,6 @@
6463
"title": "Haskell",
6564
"filename": "haskell_reference.hs",
6665
"language": "haskell",
67-
"new":true,
6866
"meta": {
6967
"title": "Haskell Reference: Comprehensive Developer's Guide",
7068
"description": "Haskell Guide covering basic to advanced concepts, including functional programming, type systems, monads, and more. Essential resource for Haskell programmers of all levels.",
@@ -75,7 +73,6 @@
7573
"title": "Vimscript",
7674
"filename": "vimscript_reference.vim",
7775
"language": "vimscript",
78-
"new":true,
7976
"meta": {
8077
"title": "Vimscript Reference: Comprehensive Developer's Guide",
8178
"description": "Vimscript Guide covering basic to advanced concepts, including mappings, functions, commands, and more for customizing the Vim editor. Essential reference for Vimscript programmers of all levels.",
@@ -86,7 +83,6 @@
8683
"title": "Go",
8784
"filename": "go_reference.go",
8885
"language": "go",
89-
"new":true,
9086
"meta": {
9187
"title": "Go Reference: Comprehensive Developer's Guide",
9288
"description": "Go Guide covering basic to advanced concepts, including concurrency, interfaces, packages, and more for building scalable applications. Essential reference for programmers of all levels.",
@@ -97,11 +93,32 @@
9793
"title": "Zig",
9894
"filename": "zig_reference.zig",
9995
"language": "zig",
100-
"new":true,
10196
"meta": {
10297
"title": "Zig Reference: Comprehensive Developer's Guide",
10398
"description": "Zig Guide covering basic to advanced concepts, including memory management, comptime, error handling, and more for system programming. Essential reference for programmers of all levels.",
10499
"keywords": "Zig Reference Guide, Zig Cheatsheet, Comprehensive Zig Guide, Zig Reference Manual"
105100
}
101+
},
102+
{
103+
"title": "Git",
104+
"filename": "git_reference.sh",
105+
"language": "shellscript",
106+
"new":true,
107+
"meta": {
108+
"title": "Git Reference: Comprehensive Developer's Guide",
109+
"description": "Git Guide covering basic to advanced concepts, including branching, merging, rebasing, and more for version control. Essential reference for developers of all levels.",
110+
"keywords": "Git Reference Guide, Git Cheatsheet, Comprehensive Git Guide, Git Reference Manual"
111+
}
112+
},
113+
{
114+
"title": "Docker",
115+
"filename": "docker_reference.sh",
116+
"language": "shellscript",
117+
"new":true,
118+
"meta": {
119+
"title": "Docker Reference: Comprehensive Developer's Guide",
120+
"description": "Docker Guide covering basic to advanced concepts, including networking, volumes, security, and more. Essential reference for developers of all levels.",
121+
"keywords": "Docker Reference Guide, Docker Cheatsheet, Comprehensive Docker Guide, Docker Reference Manual"
122+
}
106123
}
107124
]

references/docker_reference.sh

Lines changed: 297 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,297 @@
1+
# --------------------------------------------------------------------------------
2+
# Docker Reference and Guide
3+
#
4+
# ReferenceCollection.com
5+
# Licensed under CC BY-SA
6+
# --------------------------------------------------------------------------------
7+
8+
# TABLE OF CONTENTS
9+
# -----------------
10+
# 1. Introduction to Docker
11+
# 2. Core Concepts and Architecture
12+
# 3. Installation and Setup
13+
# 4. Docker Images and Containers
14+
# 5. Docker Networking
15+
# 6. Docker Volumes
16+
# 7. Docker Compose
17+
# 8. Docker Swarm
18+
# 9. Docker Security
19+
# 10. Container Registry
20+
# 11. Monitoring and Logging
21+
# 12. Troubleshooting and Maintenance
22+
23+
# --------------------------------------------------------------------------------
24+
# 1. Introduction to Docker
25+
# --------------------------------------------------------------------------------
26+
27+
# Docker is an open-source platform that automates the deployment, scaling, and
28+
# management of applications using containerization. It allows developers to package
29+
# applications and their dependencies into a standardized unit called a container.
30+
31+
# Key Features:
32+
# - Lightweight: Containers share the host OS kernel, making them more efficient than VMs
33+
# - Portable: Containers can run on any system that supports Docker
34+
# - Scalable: Easily scale applications across multiple environments
35+
# - Secure: Isolates applications from each other and the host system
36+
# - Version Control: Track container image versions
37+
# - DevOps Integration: Supports CI/CD pipelines
38+
39+
# Use Cases:
40+
# - Microservices architecture
41+
# - Development and testing environments
42+
# - Continuous Integration/Deployment (CI/CD)
43+
# - Application isolation and security
44+
45+
# --------------------------------------------------------------------------------
46+
# 2. Core Concepts and Architecture
47+
# --------------------------------------------------------------------------------
48+
49+
# Architecture Components:
50+
# - Docker Engine: Core container runtime
51+
# - Docker Daemon: Background service managing containers
52+
# - Docker Client: CLI tool for Docker interaction
53+
# - Docker Registry: Storage for Docker images
54+
# - Docker Objects: Images, containers, networks, volumes
55+
56+
# Key Concepts:
57+
# - Images: Read-only templates for creating containers
58+
# - Containers: Runnable instances of images
59+
# - Dockerfile: Instructions for building images
60+
# - Registry: Repository for storing and sharing images
61+
# - Volume: Persistent data storage
62+
# - Network: Communication between containers
63+
64+
# --------------------------------------------------------------------------------
65+
# 3. Installation and Setup
66+
# --------------------------------------------------------------------------------
67+
68+
# Linux (Ubuntu/Debian):
69+
curl -fsSL https://get.docker.com -o get-docker.sh
70+
sudo sh get-docker.sh
71+
72+
# MacOS Or Windows:
73+
# Download and install Docker Desktop from https://www.docker.com/products/docker-desktop
74+
75+
# Post-installation steps:
76+
sudo usermod -aG docker $USER # Add user to docker group
77+
newgrp docker # Apply group changes
78+
79+
# Verify installation:
80+
docker --version
81+
docker info
82+
83+
# Configure Docker daemon:
84+
cat > /etc/docker/daemon.json << EOF
85+
{
86+
"log-driver": "json-file",
87+
"log-opts": {
88+
"max-size": "10m",
89+
"max-file": "3"
90+
}
91+
}
92+
EOF
93+
94+
# Start and enable Docker service:
95+
sudo systemctl start docker
96+
sudo systemctl enable docker
97+
98+
# --------------------------------------------------------------------------------
99+
# 4. Docker Images and Containers
100+
# --------------------------------------------------------------------------------
101+
# Docker Images:
102+
# - A Docker image is a lightweight, standalone, and executable software package
103+
# that includes everything needed to run a piece of software.
104+
105+
# Image Commands:
106+
docker pull <image> # Download an image from Docker Hub
107+
docker build -t <name> . # Build an image from a Dockerfile
108+
docker images # List all images
109+
docker tag <image> <new> # Tag an image
110+
docker push <image> # Push image to registry
111+
docker rmi <image> # Remove an image
112+
113+
# Docker Containers:
114+
# - A container is a runtime instance of a Docker image, isolated from other containers
115+
# and the host system.
116+
117+
# Container Commands:
118+
docker run <image> # Run a container from an image
119+
docker ps # List running containers
120+
docker ps -a # List all containers
121+
docker stop <container> # Stop a running container
122+
docker start <container> # Start a stopped container
123+
docker restart <container> # Restart a container
124+
docker rm <container> # Remove a container
125+
docker exec -it <container> <command> # Execute command in container
126+
127+
# Resource Constraints:
128+
docker run --memory=512m <image> # Memory limit
129+
docker run --cpus=2 <image> # CPU limit
130+
docker run --pids-limit=100 <image> # Process limit
131+
132+
# --------------------------------------------------------------------------------
133+
# 5. Docker Networking
134+
# --------------------------------------------------------------------------------
135+
# Docker provides several networking options to connect containers to each other
136+
# and to the outside world.
137+
138+
# Network Types:
139+
# - Bridge: Default network type, allows containers to communicate on the same host
140+
# - Host: Shares the host's networking namespace
141+
# - None: Disables networking for a container
142+
# - Overlay: Enables communication between containers on different Docker hosts
143+
# - Macvlan: Assign MAC address to container
144+
145+
# Network Commands:
146+
docker network ls # List all networks
147+
docker network create <name> # Create a new network
148+
docker network connect <net> <container> # Connect container to network
149+
docker network disconnect <net> <container> # Disconnect container from network
150+
docker network inspect <name> # View network details
151+
docker network rm <name> # Remove a network
152+
153+
# Network Configuration:
154+
docker run --network=host <image> # Use host network
155+
docker run --dns=8.8.8.8 <image> # Custom DNS
156+
docker run --add-host=host:ip <image> # Add hosts entry
157+
158+
# --------------------------------------------------------------------------------
159+
# 6. Docker Volumes
160+
# --------------------------------------------------------------------------------
161+
# Docker volumes are used to persist data generated by and used by Docker containers.
162+
163+
# Volume Types:
164+
# - Named Volumes: Managed by Docker
165+
# - Bind Mounts: Mount host directory
166+
# - tmpfs: Temporary filesystem in memory
167+
168+
# Volume Commands:
169+
docker volume create <name> # Create a new volume
170+
docker volume ls # List all volumes
171+
docker volume inspect <name> # Display volume information
172+
docker volume rm <name> # Remove a volume
173+
docker volume prune # Remove unused volumes
174+
175+
# Volume Usage:
176+
docker run -v <vol>:/path <image> # Use named volume
177+
docker run -v /host:/container <image> # Bind mount
178+
docker run --tmpfs /path <image> # Use tmpfs mount
179+
180+
# --------------------------------------------------------------------------------
181+
# 7. Docker Compose
182+
# --------------------------------------------------------------------------------
183+
# Docker Compose is a tool for defining and running multi-container applications.
184+
185+
# Example docker-compose.yml:
186+
version: '3.8'
187+
services:
188+
web:
189+
image: nginx
190+
ports:
191+
- "80:80"
192+
volumes:
193+
- ./html:/usr/share/nginx/html
194+
db:
195+
image: postgres
196+
environment:
197+
POSTGRES_PASSWORD: secret
198+
199+
# Common Commands:
200+
docker-compose up -d # Start services in detached mode
201+
docker-compose down # Stop and remove services
202+
docker-compose ps # List services
203+
docker-compose logs # View service logs
204+
docker-compose exec web bash # Execute command in service
205+
206+
# --------------------------------------------------------------------------------
207+
# 8. Docker Swarm
208+
# --------------------------------------------------------------------------------
209+
# Docker Swarm is a native clustering and orchestration tool for Docker containers.
210+
211+
# Key Concepts:
212+
# - Node: An instance of Docker Engine in the swarm
213+
# - Service: A task that can be scaled across nodes
214+
# - Stack: Collection of services that make up an application
215+
216+
# Swarm Commands:
217+
docker swarm init # Initialize a swarm
218+
docker swarm join # Join a swarm
219+
docker node ls # List nodes
220+
docker service create # Create a service
221+
docker service ls # List services
222+
docker service scale web=3 # Scale service
223+
docker stack deploy -c docker-compose.yml <stack> # Deploy stack
224+
225+
# --------------------------------------------------------------------------------
226+
# 10. Docker Security
227+
# --------------------------------------------------------------------------------
228+
229+
# Best Practices:
230+
# - Use official images from Docker Hub
231+
# - Keep Docker and images up to date
232+
# - Scan images for vulnerabilities
233+
# - Run containers as non-root users
234+
# - Use read-only filesystems when possible
235+
# - Implement resource limits
236+
# - Enable content trust
237+
238+
# Security Commands:
239+
docker scan <image> # Scan image for vulnerabilities
240+
docker trust sign <image> # Sign image
241+
docker run --read-only <image> # Read-only filesystem
242+
docker run --security-opt=no-new-privileges <image> # Restrict privileges
243+
244+
# --------------------------------------------------------------------------------
245+
# 9. Container Registry
246+
# --------------------------------------------------------------------------------
247+
248+
# Registry Operations:
249+
docker login # Log in to a registry
250+
docker logout # Log out from a registry
251+
docker pull <image> # Pull image from registry
252+
docker push <image> # Push image to registry
253+
254+
# Private Registry:
255+
docker run -d \
256+
-p 5000:5000 \
257+
--restart=always \
258+
--name registry \
259+
registry:2
260+
261+
# --------------------------------------------------------------------------------
262+
# 11. Monitoring and Logging
263+
# --------------------------------------------------------------------------------
264+
265+
# Monitoring Commands:
266+
docker stats # View container resource usage
267+
docker events # View real-time events
268+
docker top <container> # View container processes
269+
270+
# Logging:
271+
docker logs <container> # View container logs
272+
docker logs -f <container> # Follow log output
273+
docker logs --tail 100 <container> # View last 100 lines
274+
275+
# --------------------------------------------------------------------------------
276+
# 12. Troubleshooting and Maintenance
277+
# --------------------------------------------------------------------------------
278+
279+
# Debugging Commands:
280+
docker logs <container> # View container logs
281+
docker exec -it <container> /bin/sh # Access container shell
282+
docker inspect <container> # View detailed information
283+
docker events # Monitor Docker events
284+
285+
# Cleanup Commands:
286+
docker system prune # Remove unused data
287+
docker container prune # Remove stopped containers
288+
docker image prune # Remove unused images
289+
docker volume prune # Remove unused volumes
290+
docker network prune # Remove unused networks
291+
292+
# System Information:
293+
docker info # View system-wide information
294+
docker version # View Docker version
295+
docker system df # View Docker disk usage
296+
297+
# Happy Containerizing!

0 commit comments

Comments
 (0)