https://github.com/akashdip2001/docker
Docker for study
https://github.com/akashdip2001/docker
docker docker-compose docker-container docker-image dockerfile study-notes
Last synced: 10 months ago
JSON representation
Docker for study
- Host: GitHub
- URL: https://github.com/akashdip2001/docker
- Owner: akashdip2001
- Created: 2024-12-07T21:52:18.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-19T22:28:01.000Z (about 1 year ago)
- Last Synced: 2025-02-09T00:45:06.291Z (12 months ago)
- Topics: docker, docker-compose, docker-container, docker-image, dockerfile, study-notes
- Homepage:
- Size: 143 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker Notes for DevOps Engineering
## **Table of Contents**
### **1. Introduction to Docker**
- [1.1 What is Docker?](#what-is-docker)
- [1.2 Installation](#installation)
- [1.3 Docker Container and Images](#docker-container-and-images)
- [1.4 Docker Hub](#docker-hub)
### **2. Docker Command Line Interface (CLI)**
- [2.1 Introduction to Docker CLI](#introduction-to-docker-cli)
- [2.2 Docker Image CLI](#docker-image-cli)
- [2.3 Docker Container CLI](#docker-container-cli)
### **3. Docker Custom Images**
- [3.1 Dockerfile](#dockerfile)
- [3.2 Containerize a Node.js Application](#containerize-a-nodejs-application)
- [3.3 Automatic Port Mapping](#automatic-port-mapping)
- [3.4 Pushing to Docker Hub](#pushing-to-docker-hub)
### **4. Docker Networking**
- [4.1 Bridge Mode Networking](#bridge-mode-networking)
- [4.2 Host Mode Networking](#host-mode-networking)
- [4.3 Overlay Mode Networking](#overlay-mode-networking)
- [4.4 IPvlan and MacVlan Networking](#ipvlan-and-macvlan-networking)
- [4.5 None Mode Networking](#none-mode-networking)
### **5. Docker Volumes**
- [5.1 Attaching Host Volumes](#attaching-host-volumes)
- [5.2 Custom Volumes](#custom-volumes)
### **6. Docker Compose**
- [6.1 Introduction to Docker Compose](#introduction-to-docker-compose)
- [6.2 Defining Docker Compose Files](#defining-docker-compose-files)
---
## Docker Notes for DevOps Engineering
---
### **1. Introduction to Docker**
#### [1.1 What is Docker?](#1.1)
- **Definition:** Docker is a platform for developing, shipping, and running applications inside lightweight, portable containers.
- **Key Benefits:**
- Consistency across environments
- Rapid application deployment
- Resource efficiency compared to traditional VMs
#### [1.2 Installation](#1.2)
- **Steps to Install:**
- [Windows](https://www.docker.com/products/docker-desktop/) : Use Docker Desktop (CLI + GUI)
- Linux: Use package managers like `apt` or `yum`
- MacOS: Docker Desktop or brew install docker
- **Check Installation:** Run `docker --version`.
image Guide
🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥




🚥🚥🚥🚥🚥🚥🚥🚥🚥🚥
### ========================>>> Its automaticly detect the WSL Linux

#### [1.3 Docker Container and Images](#1.3)
- **Image:** A lightweight, standalone, and executable software package.
- **Container:** An instance of an image running as an isolated process.
- **Commands:**
```bash
docker pull
docker run
```

## 🧫 [Run Docker in WSL](./01%20Docker%20in%20WSL-Kali.md)
#### [1.4 Docker Hub](#1.4)
- A cloud-based repository to store and share Docker images.
- **Usage:**
- Find public images
- Push custom images using `docker push`
---
### **2. Docker Command Line Interface (CLI)**
#### [2.1 Introduction to Docker CLI](#2.1)
- **Purpose:** Manage images, containers, and Docker resources using the terminal.
- **Basic Commands:**
- `docker ps` – List running containers
- `docker images` – List images
#### [2.2 Docker Image CLI](#2.2)
- **Key Commands:**
- `docker pull ` – Download an image
- `docker rmi ` – Remove an image
#### [2.3 Docker Container CLI](#2.3)
- **Key Commands:**
- `docker run ` – Start a container
- `docker stop ` – Stop a running container
- `docker logs ` – View logs from a container
1. [x] [Running Ubuntu img in Containers](./01%20Docker%20in%20WSL-Kali.md)
2. [x] [Multiple Containers](./02%20Docker%20Custom%20Images.md)
3. [ ] [Port Mapping](./03%20Port%20Mapping.md)
---
### **3. Docker Custom Images**
#### [3.1 Dockerfile](#3.1)
- **Definition:** A text file containing instructions to [build a Docker image](./02%20Docker%20Custom%20Images.md).
- **Sample Dockerfile:**
```dockerfile
FROM node:14
COPY . /app
WORKDIR /app
RUN npm install
CMD ["node", "app.js"]
```
- **Command to Build:**
```bash
docker build -t .
```
#### [3.2 Containerize a Node.js Application](#3.2)
- Steps to:
- Create a `Dockerfile`
- Use `docker build` and `docker run`
#### [3.3 Automatic Port Mapping](#3.3)
- Map ports using `-p` flag:
```bash
docker run -p 3000:3000
```
#### [3.4 Pushing to Docker Hub](#3.4)
- Authenticate: `docker login`
- Push Image:
```bash
docker tag /
docker push /
```
---
### **4. Docker Networking**
#### [4.1 Bridge Mode Networking](#4.1)
- Default mode. Containers share the host's networking but are isolated.
- **Command:**
```bash
docker network inspect bridge
```
#### [4.2 Host Mode Networking](#4.2)
- Shares the host network namespace.
- Useful for performance-critical apps.
#### [4.3 Overlay Mode Networking](#4.3)
- Enables multi-host container communication.
#### [4.4 IPvlan and MacVlan](#4.4)
- Advanced networking modes for performance and integration.
#### [4.5 None Mode Networking](#4.5)
- Completely disables networking for the container.
---
### **5. Docker Volumes**
#### [5.1 Attaching Host Volumes](#5.1)
- Mount directories from the host into the container.
- **Command:**
```bash
docker run -v /host/path:/container/path
```
#### [5.2 Custom Volumes](#5.2)
- Named volumes for persistent storage:
```bash
docker volume create myvolume
```
---
### **6. Docker Compose**
#### [6.1 Introduction to Docker Compose](#6.1)
- A tool to define and run multi-container Docker applications.
#### [6.2 Defining Docker Compose Files](#6.2)
- **Sample `docker-compose.yml`:**
```yaml
version: '3'
services:
app:
image: node:14
ports:
- "3000:3000"
```
- Commands:
```bash
docker-compose up
docker-compose down
```
---
### **Tables for Quick Reference**
| **Command** | **Description** |
|----------------------------|----------------------------------------------|
| `docker pull ` | Download an image |
| `docker run ` | Create and start a container |
| `docker ps` | List running containers |
| `docker stop ` | Stop a running container |
| `docker volume create` | Create a named volume |
| **Networking Mode** | **Description** |
|----------------------------|----------------------------------------------|
| Bridge | Default mode, isolated container networking |
| Host | Shares host's network namespace |
| Overlay | For multi-host communication |