363 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
		
		
			
		
	
	
			363 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| 
								 | 
							
								# TP1 - Introduction à docker et cycle de vie
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								## Sommaire
							 | 
						||
| 
								 | 
							
								2. [Installation](#2-installation)
							 | 
						||
| 
								 | 
							
								   - [2.1. Installation de Docker](#21-installation-de-docker)
							 | 
						||
| 
								 | 
							
								   - [2.2. Vérification de l'installation](#22-vérification-de-linstallation)
							 | 
						||
| 
								 | 
							
								3. [Premiers pas avec Docker](#3-premiers-pas-avec-docker)
							 | 
						||
| 
								 | 
							
								   - [3.1. Images Docker](#31-images-docker)
							 | 
						||
| 
								 | 
							
								     - [3.1.1. Lister les images disponibles](#311-lister-les-images-disponibles)
							 | 
						||
| 
								 | 
							
								     - [3.1.2. Télécharger une image](#312-télécharger-une-image)
							 | 
						||
| 
								 | 
							
								     - [3.1.3. Rechercher une image](#313-rechercher-une-image)
							 | 
						||
| 
								 | 
							
								   - [3.2. Gestion basique des conteneurs](#32-gestion-basique-des-conteneurs)
							 | 
						||
| 
								 | 
							
								     - [3.2.1. Créer un premier conteneur](#321-créer-un-premier-conteneur)
							 | 
						||
| 
								 | 
							
								     - [3.2.2. Observer la différence en mode détaché](#322-observer-la-différence-en-mode-détaché)
							 | 
						||
| 
								 | 
							
								4. [Cycle de vie des conteneurs](#4-cycle-de-vie-des-conteneurs)
							 | 
						||
| 
								 | 
							
								   - [4.1. États des conteneurs](#41-états-des-conteneurs)
							 | 
						||
| 
								 | 
							
								     - [4.1.1. Commandes d'observation](#411-commandes-dobservation)
							 | 
						||
| 
								 | 
							
								     - [4.1.2. Exercice pratique](#412-exercice-pratique)
							 | 
						||
| 
								 | 
							
								   - [4.2. Manipulation des états](#42-manipulation-des-états)
							 | 
						||
| 
								 | 
							
								5. [Inspection et Debug](#5-inspection-et-debug)
							 | 
						||
| 
								 | 
							
								   - [5.1. Logs et monitoring](#51-logs-et-monitoring)
							 | 
						||
| 
								 | 
							
								   - [5.2. Inspection détaillée](#52-inspection-détaillée)
							 | 
						||
| 
								 | 
							
								6. [Exercice final](#6-exercice-final)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								## 2. Installation 
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								### 2.1. Installation de Docker
							 | 
						||
| 
								 | 
							
								URL de la page de documentation : https://docs.docker.com/desktop/setup/install/linux/archlinux/  
							 | 
						||
| 
								 | 
							
								**Note** : Docker est déjà installé sur le système des machines de l'IUT.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								### 2.2 Vérification de l'installation
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								# Vérification de la version installée
							 | 
						||
| 
								 | 
							
								sudo docker --version
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** :
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								Docker version 27.2.0, build 3ab4256958
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								# Test de fonctionnement avec l'image "hello-world"
							 | 
						||
| 
								 | 
							
								sudo docker run hello-world
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** :
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								Hello from Docker!
							 | 
						||
| 
								 | 
							
								This message shows that your installation appears to be working correctly.
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								## 3. Premiers pas avec Docker
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								### 3.1. Images Docker 
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#### 3.1.1. Lister les images disponibles 
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker images 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								REPOSITORY                TAG          IMAGE ID       CREATED         SIZE
							 | 
						||
| 
								 | 
							
								<none>                    <none>       87a2e3453d58   12 days ago     509MB
							 | 
						||
| 
								 | 
							
								<none>                    <none>       93d79f7e6a26   12 days ago     509MB
							 | 
						||
| 
								 | 
							
								<none>                    <none>       7f2d24628277   12 days ago     509MB
							 | 
						||
| 
								 | 
							
								chocolate_app-backend     latest       d7032a3bdf2f   12 days ago     509MB
							 | 
						||
| 
								 | 
							
								[...]
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#### 3.1.2. Télécharger une image 
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker pull nginx
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								Using default tag: latest
							 | 
						||
| 
								 | 
							
								latest: Pulling from library/nginx
							 | 
						||
| 
								 | 
							
								6e909acdb790: Already exists 
							 | 
						||
| 
								 | 
							
								5eaa34f5b9c2: Pull complete 
							 | 
						||
| 
								 | 
							
								417c4bccf534: Pull complete 
							 | 
						||
| 
								 | 
							
								e7e0ca015e55: Pull complete 
							 | 
						||
| 
								 | 
							
								373fe654e984: Pull complete 
							 | 
						||
| 
								 | 
							
								97f5c0f51d43: Pull complete 
							 | 
						||
| 
								 | 
							
								c22eb46e871a: Pull complete 
							 | 
						||
| 
								 | 
							
								Digest: sha256:124b44bfc9ccd1f3cedf4b592d4d1e8bddb78b51ec2ed5056c52d3692baebc19
							 | 
						||
| 
								 | 
							
								Status: Downloaded newer image for nginx:latest
							 | 
						||
| 
								 | 
							
								docker.io/library/nginx:latest
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#### 3.1.3. Rechercher une image
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker search ubuntu
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								NAME                             DESCRIPTION                                     STARS     OFFICIAL
							 | 
						||
| 
								 | 
							
								ubuntu                           Ubuntu is a Debian-based Linux operating sys…   17524     [OK]
							 | 
						||
| 
								 | 
							
								ubuntu/squid                     Squid is a caching proxy for the Web. Long-t…   108       
							 | 
						||
| 
								 | 
							
								ubuntu/nginx                     Nginx, a high-performance reverse proxy & we…   128       
							 | 
						||
| 
								 | 
							
								ubuntu/cortex                    Cortex provides storage for Prometheus. Long…   4         
							 | 
						||
| 
								 | 
							
								ubuntu/kafka                     Apache Kafka, a distributed event streaming …   53         
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								### 3.2 Gestion basique des conteneurs 
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#### 3.2.1. Créer un premier conteneur
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker run nginx 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
							 | 
						||
| 
								 | 
							
								/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
							 | 
						||
| 
								 | 
							
								/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
							 | 
						||
| 
								 | 
							
								[...]
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#### 3.2.2. Observer la différence en mode détaché
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker run -d nginx
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								e624c2ff986d10b23dc4836b3a0cb4c89013f0188b48693a307280d96735e0ff
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								## 4. Cycle de vie des conteneurs 
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								### 4.1. États des conteneurs
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#### 4.1.1. Commandes d'observation
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								# Conteneurs en cours d'exécution
							 | 
						||
| 
								 | 
							
								sudo docker ps 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								CONTAINER ID   IMAGE     COMMAND                  CREATED         STATUS         PORTS     NAMES
							 | 
						||
| 
								 | 
							
								e624c2ff986d   nginx     "/docker-entrypoint.…"   6 minutes ago   Up 6 minutes   80/tcp    gallant_roentgen
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								# Liste de tous les conteneurs (actifs et inactifs)
							 | 
						||
| 
								 | 
							
								sudo docker ps -a
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								CONTAINER ID   IMAGE             COMMAND                  CREATED          STATUS                      PORTS     NAMES
							 | 
						||
| 
								 | 
							
								e624c2ff986d   nginx             "/docker-entrypoint.…"   8 minutes ago    Up 8 minutes                80/tcp    gallant_roentgen
							 | 
						||
| 
								 | 
							
								1ec88668966f   nginx             "/docker-entrypoint.…"   9 minutes ago    Exited (0) 8 minutes ago              musing_kowalevski
							 | 
						||
| 
								 | 
							
								f27bbe04a801   hello-world       "/hello"                 13 minutes ago   Exited (0) 13 minutes ago             loving_ritchie
							 | 
						||
| 
								 | 
							
								8e68c7f4032a   hello-world       "/hello"                 13 minutes ago   Exited (0) 13 minutes ago             wonderful_proskuriakova
							 | 
						||
| 
								 | 
							
								[...]
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#### 4.1.2. Exercice pratique
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								1. Création de trois conteneurs nginx avec des noms différents :
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker run -d --name web1 nginx
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** :
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								74ea9e483cdfc65659e8d957de11da91c8e4c8e523f950f5bb140596fb197e90
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker run -d --name web2 nginx
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** :
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								10df9341c62a04d78b7ba5649c5e45c865013ea616b21362fbbd026a99e86f90
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker run -d --name web3 nginx
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** :
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								1ecd55481aedc61da233a6b26f5b4041f24f2eaa378e9cb44aed4a1180d4c97c
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								2. Observation des états des conteneurs :
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker ps
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** :
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS          PORTS     NAMES
							 | 
						||
| 
								 | 
							
								1ecd55481aed   nginx     "/docker-entrypoint.…"   22 seconds ago   Up 22 seconds   80/tcp    web3
							 | 
						||
| 
								 | 
							
								10df9341c62a   nginx     "/docker-entrypoint.…"   25 seconds ago   Up 25 seconds   80/tcp    web2
							 | 
						||
| 
								 | 
							
								74ea9e483cdf   nginx     "/docker-entrypoint.…"   29 seconds ago   Up 28 seconds   80/tcp    web1
							 | 
						||
| 
								 | 
							
								e624c2ff986d   nginx     "/docker-entrypoint.…"   11 minutes ago   Up 11 minutes   80/tcp    gallant_roentgen
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								3. Colonnes importantes dans la sortie de `docker ps` :
							 | 
						||
| 
								 | 
							
								   - **STATUS** : pour voir le statut actuel du conteneur
							 | 
						||
| 
								 | 
							
								   - **NAMES** : pour voir le nom attribué au conteneur
							 | 
						||
| 
								 | 
							
								   - **CONTAINER ID** : pour identifier le conteneur de manière unique
							 | 
						||
| 
								 | 
							
								   - **PORTS** : pour voir les ports exposés par le conteneur
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								### 4.2. Manipulation des états
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker stop web1
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								web1
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker start web1
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								web1
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker restart web2
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								web2
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker pause web3
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								web3
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker unpause web3
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								web3
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker kill web1
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								web1
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								## 5. Inspection et Debug
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								### 5.1. Logs et monitoring
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker logs web3
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
							 | 
						||
| 
								 | 
							
								/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
							 | 
						||
| 
								 | 
							
								/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
							 | 
						||
| 
								 | 
							
								[...]
							 | 
						||
| 
								 | 
							
								[FIN DE L'EXECUTION]
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker logs -f web3
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
							 | 
						||
| 
								 | 
							
								/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
							 | 
						||
| 
								 | 
							
								/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
							 | 
						||
| 
								 | 
							
								[...]
							 | 
						||
| 
								 | 
							
								[NE S'ARRETE PAS]
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker stats 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								CONTAINER ID   NAME               CPU %     MEM USAGE / LIMIT    MEM %     NET I/O       BLOCK I/O     PIDS
							 | 
						||
| 
								 | 
							
								1ecd55481aed   web3               0.00%     12.8MiB / 15.4GiB    0.08%     4.43kB / 0B   0B / 12.3kB   17
							 | 
						||
| 
								 | 
							
								10df9341c62a   web2               0.00%     12.62MiB / 15.4GiB   0.08%     2.69kB / 0B   0B / 4.1kB    17
							 | 
						||
| 
								 | 
							
								e624c2ff986d   gallant_roentgen   0.00%     12.74MiB / 15.4GiB   0.08%     7.23kB / 0B   0B / 12.3kB   17
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								### 5.2. Inspection détaillée
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker inspect web3 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```json
							 | 
						||
| 
								 | 
							
								[
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        "Id": "1ecd55481aedc61da233a6b26f5b4041f24f2eaa378e9cb44aed4a1180d4c97c",
							 | 
						||
| 
								 | 
							
								        "Created": "2025-04-01T13:37:34.201569663Z",
							 | 
						||
| 
								 | 
							
								        "Path": "/docker-entrypoint.sh",
							 | 
						||
| 
								 | 
							
								            [...]
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								]
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker exec -it web3 /bin/bash
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								root@1ecd55481aed:/# 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								*Note: Cette commande permet d'accéder à un terminal interactif à l'intérieur du conteneur.*
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								## 6. Exercice final
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker run -d --name web-test nginx
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								c7bd94aad4f8f9f9e24fada2c5eb09c60771852a434a3245561ebda94372ad63
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker ps 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS          PORTS     NAMES
							 | 
						||
| 
								 | 
							
								c7bd94aad4f8   nginx     "/docker-entrypoint.…"   42 seconds ago   Up 41 seconds   80/tcp    web-test
							 | 
						||
| 
								 | 
							
								1ecd55481aed   nginx     "/docker-entrypoint.…"   35 minutes ago   Up 35 minutes   80/tcp    web3
							 | 
						||
| 
								 | 
							
								10df9341c62a   nginx     "/docker-entrypoint.…"   35 minutes ago   Up 6 minutes    80/tcp    web2
							 | 
						||
| 
								 | 
							
								e624c2ff986d   nginx     "/docker-entrypoint.…"   46 minutes ago   Up 46 minutes   80/tcp    gallant_roentgen
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker ps -a 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								CONTAINER ID   IMAGE             COMMAND                  CREATED              STATUS                       PORTS     NAMES
							 | 
						||
| 
								 | 
							
								c7bd94aad4f8   nginx             "/docker-entrypoint.…"   About a minute ago   Up About a minute            80/tcp    web-test
							 | 
						||
| 
								 | 
							
								1ecd55481aed   nginx             "/docker-entrypoint.…"   36 minutes ago       Up 36 minutes                80/tcp    web3
							 | 
						||
| 
								 | 
							
								10df9341c62a   nginx             "/docker-entrypoint.…"   36 minutes ago       Up 6 minutes                 80/tcp    web2
							 | 
						||
| 
								 | 
							
								74ea9e483cdf   nginx             "/docker-entrypoint.…"   36 minutes ago       Exited (137) 6 minutes ago             web1
							 | 
						||
| 
								 | 
							
								[...]
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								```bash
							 | 
						||
| 
								 | 
							
								sudo docker logs web-test
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								**Résultat** : 
							 | 
						||
| 
								 | 
							
								```
							 | 
						||
| 
								 | 
							
								/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
							 | 
						||
| 
								 | 
							
								/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
							 | 
						||
| 
								 | 
							
								/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
							 | 
						||
| 
								 | 
							
								[...]
							 | 
						||
| 
								 | 
							
								```
							 |