# Commandes Docker pour l'exercice 2

## Construction de l'image
```bash
docker build -t apache-static:1.8 .
```

## Lancement d'un conteneur
```bash
docker run -d -p 8080:80 --name apache-static-container apache-static:1.8
# 98f3ffa33561f25e0320a4eeac67e83fe5629e8caf4883f7a35c83b9295e4a5a
```

## Vérification du site web
```bash
curl http://localhost:8080
```
Résultat : 
```html
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <title>Stage - Compte à rebours</title>
    <style>
        body {...
```

## Vérification des variables d'environnement
```bash
docker exec apache-static-container env | grep SCHOOL
docker exec apache-static-container env | grep LEVEL
```

Résultat :
```bash
SCHOOL=IUT
LEVEL=1
```

## Vérification du healthcheck
```bash
docker inspect --format='{{json .State.Health}}' apache-static-container
```

Résultat : 
```json
{"Status":"healthy","FailingStreak":0,"Log":[{"Start":"2025-04-08T16:15:36.513084342+02:00","End":"2025-04-08T16:15:36.577562059+02:00","ExitCode":0,"Output":"Connecting to localhost ([::1]:80)\nremote file exists\n"}]}
```

## Publication sur Docker Hub
```bash
# Connexion à Docker Hub
docker login

# Tag de l'image
docker tag apache-static:1.8 username/apache-static:1.8

# Push vers Docker Hub
docker push moncef45/apache-static:1.8

# mon username = moncef45
```

Lien Docker Hub: https://hub.docker.com/u/moncef45