https://github.com/saketkothari/docker
🐳 Docker is a container management tool, that makes it easy to run applications on any computer in an isolated container, that includes everything it needs to run predictably.
https://github.com/saketkothari/docker
docker docker-compose docker-container docker-image docker-volumes dockerfile
Last synced: about 1 month ago
JSON representation
🐳 Docker is a container management tool, that makes it easy to run applications on any computer in an isolated container, that includes everything it needs to run predictably.
- Host: GitHub
- URL: https://github.com/saketkothari/docker
- Owner: SaketKothari
- Created: 2022-02-08T11:44:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-02-21T08:26:45.000Z (over 4 years ago)
- Last Synced: 2025-01-26T02:28:38.270Z (over 1 year ago)
- Topics: docker, docker-compose, docker-container, docker-image, docker-volumes, dockerfile
- Language: HTML
- Homepage:
- Size: 279 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🐳 Docker Multi-Container Blog Application
A full-stack blog application demonstrating Docker containerization with a React frontend and Express.js backend API, orchestrated using Docker Compose.
## 📋 Overview
This project showcases how to containerize a multi-service application using Docker. It consists of:
- **Frontend (myblog)**: A React application that displays blog posts
- **Backend (api)**: An Express.js REST API that serves blog data
Both services are containerized and can be run together using Docker Compose.
## 🏗️ Project Structure
```
docker/
├── docker-compose.yaml # Multi-container orchestration
├── api/ # Backend Express.js API
│ ├── Dockerfile
│ ├── package.json
│ └── app.js
└── myblog/ # Frontend React Application
├── Dockerfile
├── package.json
├── public/
└── src/
└── App.js
```
## 🛠️ Tech Stack
| Service | Technology | Port |
|----------|-------------------|------|
| Frontend | React 17 | 3000 |
| Backend | Express.js + Node | 4000 |
## 🚀 Quick Start
### Prerequisites
- [Docker](https://docs.docker.com/get-docker/) installed on your machine
- [Docker Compose](https://docs.docker.com/compose/install/) (included with Docker Desktop)
### Running the Application
1. **Clone the repository**
```bash
git clone https://github.com/SaketKothari/docker.git
cd docker
```
2. **Start all services with Docker Compose**
```bash
docker-compose up
```
3. **Access the application**
- Frontend: http://localhost:3000
- API: http://localhost:4000
4. **Stop all services**
```bash
docker-compose down
```
## 📡 API Endpoints
| Method | Endpoint | Description |
|--------|----------|-----------------------|
| GET | `/` | Returns list of blogs |
### Sample Response
```json
[
{ "id": "1", "title": "Book Review: The Bear & The Nightingale." },
{ "id": "2", "title": "Game Review: Pokemon Brilliant Diamond" },
{ "id": "3", "title": "Show Review: Alice in Borderland" }
]
```
## 🐳 Docker Commands Reference
### Basic Commands
| Command | Description |
|---------|-------------|
| `docker build -t .` | Build an image from Dockerfile |
| `docker images` | List all images |
| `docker ps -a` | List all containers |
| `docker run --name -p : ` | Run a container |
| `docker stop ` | Stop a running container |
| `docker start ` | Start an existing container |
### Image Management
```bash
# Build an image
docker build -t myapp .
# Build with version tag
docker build -t myapp:v1 .
# Remove an image
docker image rm myapp
# Force remove an image
docker image rm myapp -f
```
### Container Management
```bash
# Run container in detached mode with port mapping
docker run --name myapp_c -p 4000:4000 -d myapp
# Stop a container
docker stop myapp_c
# Remove a container
docker container rm myapp_c
# Remove all unused images and containers
docker system prune -a
```
### Docker Compose Commands
```bash
# Build and start all services
docker-compose up
# Build and start in detached mode
docker-compose up -d
# Stop and remove containers, networks, images, and volumes
docker-compose down --rmi all -v
# View running services
docker-compose ps
```
## 📚 Docker Concepts Covered
| # | Topic |
|:-:|-------|
| 1 | What is Docker |
| 2 | Installing Docker |
| 3 | Images and Containers |
| 4 | Parent Images & Docker Hub |
| 5 | The Dockerfile |
| 6 | .dockerignore |
| 7 | Starting & Stopping Containers |
| 8 | Layer Caching |
| 9 | Managing Images and Containers |
| 10 | Volumes |
| 11 | Docker Compose |
| 12 | Dockerizing a React App |
| 13 | Sharing Images on Docker Hub |
---
Made with ❤️ by [Saket Kothari](https://github.com/SaketKothari)