EXP1:

1) docker pull nginx
   docker run -d -p 8080:80 nginx

2) dockerfile:
FROM httpd:latest

COPY index.html /usr/local/apache2/htdocs/

EXPOSE 80

(create the index.html)

  docker build -f dockerfile -t webserver .
  docker run -itd --name "apache2-webserver" -p 8081:80 webserver:latest


3)docker ps
  docker rm apache2-webserver

4)docker pull ubuntu:latest
  mkdir storage
  echo "Hello I am harsh speaking from da host machine" >> note.txt
  docker run -it -v .:/tmp ubuntu bash


EXP2:

1)
docker-compose.yml:
services:
  web:
    build: ./web
    ports:
      - "5000:5000"
    depends_on:
      - redis
    environment:
      - REDIS_HOST=redis
    deploy:
      replicas: 1

  redis:
    image: redis:alpine
    ports:
      - "6379:6379"

/web
app.py:
import os
import redis
from flask import Flask

app = Flask(__name__)
cache = redis.Redis(
    host=os.getenv("REDIS_HOST", "redis"),
    port=int(os.getenv("REDIS_PORT", "6379")),
)

@app.route("/")
def hello():
    count = cache.incr("hits")
    return f"Hello from Docker! I have been seen {count} time(s).\n"


requirements.txt:
flask
redis

dockerfile:
FROM python:3.12-alpine

WORKDIR /code

RUN apk add --no-cache gcc musl-dev linux-headers

COPY requirements.txt .

RUN pip install -r requirements.txt

COPY . .

EXPOSE 5000

CMD ["flask", "run", "--host=0.0.0.0"]




