Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
elearning:workbooks:docker3:drf03 [2022/07/21 13:23] adminelearning:workbooks:docker3:drf03 [2024/02/21 13:40] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
  
-Version : **2022.01**+Version : **2024.01**
  
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
Ligne 14: Ligne 14:
       * 1.1 - Gestion Automatique par Docker       * 1.1 - Gestion Automatique par Docker
       * 1.2 - Gestion Manuelle d'un Volume       * 1.2 - Gestion Manuelle d'un Volume
 +      * 1.3 - Gestion Manuelle d'un Bindmount
     * LAB #2 - Gestion du Réseau     * LAB #2 - Gestion du Réseau
       * 2.1 - L'Approche Réseau Docker       * 2.1 - L'Approche Réseau Docker
Ligne 29: Ligne 30:
 =====LAB #1 - Gestion des Volumes===== =====LAB #1 - Gestion des Volumes=====
  
-Lancez un conteneur à partir de la dernière image :+Lancez le conteneur **mongo2** :
  
 <code> <code>
-root@debian9:~/mongodb# docker run -d --name mongo2 i2tch/mongodb2 +root@debian11:~# docker start mongo2 
-e91a055283f4d67cbd91d11bb3faa6f67925893cb18f9cc25023e72e0f7ed85a+mongo2
 </code> </code>
  
Ligne 41: Ligne 42:
  
 <code> <code>
-root@debian9:~# docker ps +root@debian11:~# docker ps 
-CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES +CONTAINER ID   IMAGE            COMMAND                  CREATED      STATUS          PORTS       NAMES 
-b9773e4aa06d        i2tch/mongodb2      "docker-entrypoint...  7 hours ago         Up About a minute   27017/tcp           mongo2+880733c6bdc3   i2tch/mongodb2   "docker-entrypoint.s…  4 days ago   Up 43 seconds   27017/tcp   mongo2
 </code> </code>
  
Ligne 49: Ligne 50:
  
 <code> <code>
-root@debian9:~# docker inspect mongo2+root@debian11:~# docker inspect mongo2
 ... ...
         "Mounts": [         "Mounts": [
             {             {
                 "Type": "volume",                 "Type": "volume",
-                "Name": "9c84c2d1a0db811a3c13dce354ba21169f3073513c8d025dd96c5f902364d44a", +                "Name": "537cc5d0f0f0aa0af9dd959b45fc9fcbe8467a868b9d61919991366a2813f703", 
-                "Source": "/var/lib/docker/volumes/9c84c2d1a0db811a3c13dce354ba21169f3073513c8d025dd96c5f902364d44a/_data", +                "Source": "/var/lib/docker/volumes/537cc5d0f0f0aa0af9dd959b45fc9fcbe8467a868b9d61919991366a2813f703/_data", 
-                "Destination": "/data/configdb",+                "Destination": "/data/db",
                 "Driver": "local",                 "Driver": "local",
                 "Mode": "",                 "Mode": "",
Ligne 64: Ligne 65:
             {             {
                 "Type": "volume",                 "Type": "volume",
-                "Name": "a6177cf4b46089356280f084dd2e272f673aa4a81accb53f031267fafcee6050", +                "Name": "58795fb69d54b87b11fcb6ab752a1fa10736e5aa37c8a14b1c36db1306853a59", 
-                "Source": "/var/lib/docker/volumes/a6177cf4b46089356280f084dd2e272f673aa4a81accb53f031267fafcee6050/_data", +                "Source": "/var/lib/docker/volumes/58795fb69d54b87b11fcb6ab752a1fa10736e5aa37c8a14b1c36db1306853a59/_data", 
-                "Destination": "/data/db",+                "Destination": "/data/configdb",
                 "Driver": "local",                 "Driver": "local",
                 "Mode": "",                 "Mode": "",
Ligne 72: Ligne 73:
                 "Propagation": ""                 "Propagation": ""
             }             }
 +        ],
 ... ...
             "Volumes": {             "Volumes": {
Ligne 83: Ligne 85:
  
 <code> <code>
-root@debian9:~# ls /var/lib/docker/volumes/a6177cf4b46089356280f084dd2e272f673aa4a81accb53f031267fafcee6050/_data +root@debian11:~# ls /var/lib/docker/volumes/537cc5d0f0f0aa0af9dd959b45fc9fcbe8467a868b9d61919991366a2813f703/_data 
-journal  local. local.ns  mongod.lock  storage.bson+collection-0-2505194079268383602.wt  index-5-2505194079268383602.wt  storage.bson 
 +collection-2-2505194079268383602.wt  index-6-2505194079268383602.wt  WiredTiger 
 +collection-4-2505194079268383602.wt  journal                         WiredTigerLAS.wt 
 +diagnostic.data                      _mdb_catalog.wt                 WiredTiger.lock 
 +index-1-2505194079268383602.wt       mongod.lock                     WiredTiger.turtle 
 +index-3-2505194079268383602.wt       sizeStorer.wt                   WiredTiger.wt
 </code> </code>
  
Ligne 90: Ligne 97:
  
 <code> <code>
-root@debian9:~# docker stop mongo2+root@debian11:~# docker stop mongo2
 mongo2 mongo2
-root@debian9:~# docker ps -a + 
-CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS               NAMES +root@debian11:~# docker rm mongo2
-ea239635e141        testcache           "more /tmp/moment"       6 hours ago         Exited (0) 6 hours ago                          test1 +
-21b0490a93dd        i2tch/mydocker      "/entrypoint.sh my..."   6 hours ago         Exited (137) 6 hours ago                        myDocker +
-b9773e4aa06d        i2tch/mongodb2      "docker-entrypoint..."   7 hours ago         Exited (0) 10 seconds ago                       mongo2 +
-bdb4bc0f81de        i2tch/mongodb1      "docker-entrypoint..."   18 hours ago        Created                     27017/tcp           mongo1 +
-f5b45072b831        i2tch/mongodb       "bash"                   18 hours ago        Exited (137) 6 hours ago                        mongo +
-9731a48f126a        nginx               "nginx -g 'daemon ..."   18 hours ago        Exited (0) 6 hours ago                          cocky_gates +
-eacd70596e23        nginx               "nginx -g 'daemon ..."   19 hours ago        Exited (0) 19 hours ago                         adoring_yonath +
-cffb4456e9c4        ubuntu              "/bin/bash"              19 hours ago        Exited (0) 19 hours ago                         i2tch +
-root@debian9:~# docker rm mongo2+
 mongo2 mongo2
-root@debian9:~# docker ps -a 
-CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS               NAMES 
-ea239635e141        testcache           "more /tmp/moment"       6 hours ago         Exited (0) 6 hours ago                         test1 
-21b0490a93dd        i2tch/mydocker      "/entrypoint.sh my..."   6 hours ago         Exited (137) 6 hours ago                       myDocker 
-bdb4bc0f81de        i2tch/mongodb1      "docker-entrypoint..."   18 hours ago        Created                    27017/tcp           mongo1 
-f5b45072b831        i2tch/mongodb       "bash"                   18 hours ago        Exited (137) 6 hours ago                       mongo 
-9731a48f126a        nginx               "nginx -g 'daemon ..."   18 hours ago        Exited (0) 6 hours ago                         cocky_gates 
-eacd70596e23        nginx               "nginx -g 'daemon ..."   19 hours ago        Exited (0) 19 hours ago                        adoring_yonath 
-cffb4456e9c4        ubuntu              "/bin/bash"              19 hours ago        Exited (0) 19 hours ago                        i2tch 
 </code> </code>
  
Ligne 118: Ligne 107:
  
 <code> <code>
-root@debian9:~# docker run -d --name mongo2 i2tch/mongodb2 +root@debian11:~# docker run -d --name mongo2 i2tch/mongodb2 
-a8382642c4e849337e12a60419b10f63ea21251dfcc2c6050284ca3eed7fa13d +1980be05ac73d70979f5e932f1a58b6526ae1001a335fd8ca010bbfaac48ca5e 
-root@debian9:~# docker ps -a + 
-CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                        PORTS               NAMES +root@debian11:~# docker ps 
-a8382642c4e8        i2tch/mongodb2      "docker-entrypoint...  12 seconds ago      Exited (100) 11 seconds ago                       mongo2 +CONTAINER ID   IMAGE            COMMAND                  CREATED         STATUS         PORTS       NAMES 
-ea239635e141        testcache           "more /tmp/moment"       6 hours ago         Exited (0) 6 hours ago                            test1 +1980be05ac73   i2tch/mongodb2   "docker-entrypoint.s…  seconds ago   Up 4 seconds   27017/tcp   mongo2
-21b0490a93dd        i2tch/mydocker      "/entrypoint.sh my..."   6 hours ago         Exited (137) 6 hours ago                          myDocker +
-bdb4bc0f81de        i2tch/mongodb1      "docker-entrypoint..."   18 hours ago        Created                       27017/tcp           mongo1 +
-f5b45072b831        i2tch/mongodb       "bash"                   18 hours ago        Exited (137) 6 hours ago                          mongo +
-9731a48f126a        nginx               "nginx -g 'daemon ..."   18 hours ago        Exited (0) 6 hours ago                            cocky_gates +
-eacd70596e23        nginx               "nginx -g 'daemon ..."   19 hours ago        Exited (0) 19 hours ago                           adoring_yonath +
-cffb4456e9c4        ubuntu              "/bin/bash"              19 hours ago        Exited (0) 19 hours ago                           i2tch+
 </code> </code>
  
Ligne 135: Ligne 118:
  
 <code> <code>
-root@debian9:~# docker inspect mongo2+root@debian11:~# docker inspect mongo2
 ... ...
         "Mounts": [         "Mounts": [
             {             {
                 "Type": "volume",                 "Type": "volume",
-                "Name": "76dcc0ccbe6604278cf8e8da0398a807f5d0719087f17c227c8504be24456d43", +                "Name": "2ec1edeca3acd91aede62091e0d96252eb31e403a00fef324ca2244b2952bb48", 
-                "Source": "/var/lib/docker/volumes/76dcc0ccbe6604278cf8e8da0398a807f5d0719087f17c227c8504be24456d43/_data", +                "Source": "/var/lib/docker/volumes/2ec1edeca3acd91aede62091e0d96252eb31e403a00fef324ca2244b2952bb48/_data", 
-                "Destination": "/data/db",+                "Destination": "/data/configdb",
                 "Driver": "local",                 "Driver": "local",
                 "Mode": "",                 "Mode": "",
Ligne 150: Ligne 133:
             {             {
                 "Type": "volume",                 "Type": "volume",
-                "Name": "3bf724ceb38ce0792469d7e403f05b6794f27e0aa72bda51a8ab75b2df5ae87c", +                "Name": "4abe232050675d853d0a4d8beefe31f884e1252c985828c3be47a983aac58605", 
-                "Source": "/var/lib/docker/volumes/3bf724ceb38ce0792469d7e403f05b6794f27e0aa72bda51a8ab75b2df5ae87c/_data", +                "Source": "/var/lib/docker/volumes/4abe232050675d853d0a4d8beefe31f884e1252c985828c3be47a983aac58605/_data", 
-                "Destination": "/data/configdb",+                "Destination": "/data/db",
                 "Driver": "local",                 "Driver": "local",
                 "Mode": "",                 "Mode": "",
Ligne 158: Ligne 141:
                 "Propagation": ""                 "Propagation": ""
             }             }
 +        ],
 ... ...
 </code> </code>
  
-<WRAP center round important> +<WRAP center round important 50%
-**Important** : Notez que le répertoire des données du précédent conteneur, **/var/lib/docker/volumes/a6177cf4b46089356280f084dd2e272f673aa4a81accb53f031267fafcee6050/_data** n'est pas le même que le conteneur courant **/var/lib/docker/volumes/76dcc0ccbe6604278cf8e8da0398a807f5d0719087f17c227c8504be24456d43/_data**.+**Important** : Notez que le répertoire des données du précédent conteneur, **/var/lib/docker/volumes/537cc5d0f0f0aa0af9dd959b45fc9fcbe8467a868b9d61919991366a2813f703/_data** n'est pas le même que le conteneur courant **/var/lib/docker/volumes/4abe232050675d853d0a4d8beefe31f884e1252c985828c3be47a983aac58605/_data**.
 </WRAP> </WRAP>
  
Ligne 168: Ligne 152:
  
 <code> <code>
-root@debian9:~# ls -l /var/lib/docker/volumes/ +root@debian11:~# ls -l /var/lib/docker/volumes/ 
-total 52 +total 60 
-drwxr-xr-x 3 root root  4096 Sep  7 09:43 3bf724ceb38ce0792469d7e403f05b6794f27e0aa72bda51a8ab75b2df5ae87c +drwx-----x 3 root root  4096 Dec 15 14:39 2ec1edeca3acd91aede62091e0d96252eb31e403a00fef324ca2244b2952bb48 
-drwxr-xr-x 3 root root  4096 Sep  6 16:07 46d11d005d05757609ff76159ce0992d210089c5247fa54b024706a20b0de501 +drwx-----x 3 root root  4096 Dec 10 17:12 396ad783162131dcc92a649366ab79e24720bf866ce6803868e2ba2df8e90074 
-drwxr-xr-x 3 root root  4096 Sep  7 09:43 76dcc0ccbe6604278cf8e8da0398a807f5d0719087f17c227c8504be24456d43 +drwx-----x 3 root root  4096 Dec 15 14:39 4abe232050675d853d0a4d8beefe31f884e1252c985828c3be47a983aac58605 
-drwxr-xr-x 3 root root  4096 Sep  7 02:33 9c84c2d1a0db811a3c13dce354ba21169f3073513c8d025dd96c5f902364d44a +drwx-----x 3 root root  4096 Dec 10 17:16 537cc5d0f0f0aa0af9dd959b45fc9fcbe8467a868b9d61919991366a2813f703 
-drwxr-xr-x 3 root root  4096 Sep  7 02:33 a6177cf4b46089356280f084dd2e272f673aa4a81accb53f031267fafcee6050 +drwx-----x 3 root root  4096 Dec 10 17:16 58795fb69d54b87b11fcb6ab752a1fa10736e5aa37c8a14b1c36db1306853a59 
-drwxr-xr-x 3 root root  4096 Sep  6 16:07 cc38fa97138adc55976aa16993d8920c5f7da922ad1b2a07936d30cc82d59f38 +drwx-----x 3 root root  4096 Dec 10 18:32 7d7b25232f6ec411dc9dfb888048eebbee919eb2cedc301969bc325a8a8d055e 
--rw------- 1 root root 32768 Sep  7 09:43 metadata.db+brw------- 1 root root 8, 33 Dec 15 09:56 backingFsBlockDev 
 +drwx-----x 3 root root  4096 Dec 10 17:12 f766fb3cd11eee28312b8804c1439c0f7b0a7d58a0ce4d61ba50af17b7630c8f 
 +-rw------- 1 root root 65536 Dec 15 14:39 metadata.db
 </code> </code>
  
-<WRAP center round important>+<WRAP center round important 50%>
 **Important** : Notez que non-seulement ceci représente une source de perte d'espace disque mais prouve aussi que les données ne sont pas persistantes entre deux instances d'un conteneur d'**i2tch/mongodb2**. Ceci crée bien évidement un problème important en production. **Important** : Notez que non-seulement ceci représente une source de perte d'espace disque mais prouve aussi que les données ne sont pas persistantes entre deux instances d'un conteneur d'**i2tch/mongodb2**. Ceci crée bien évidement un problème important en production.
 </WRAP> </WRAP>
Ligne 188: Ligne 174:
  
 <code> <code>
-root@debian9:~# docker stop mongo2+root@debian11:~# docker stop mongo2
 mongo2 mongo2
-root@debian9:~# docker rm mongo2+ 
 +root@debian11:~# docker rm mongo2
 mongo2 mongo2
-root@debian9:~# docker run -d --name mongo2 -v persistent_data:/data/db i2tch/mongodb2 + 
-3cf093d72b9e3739f2cb288e571244e494b7518292c31994ee012e3620bb0e98 +root@debian11:~# docker run -d --name mongo2 -v persistent_data:/data/db i2tch/mongodb2 
-root@debian9:~# docker ps -a +8b2207df56a727a8472b2949d7a83a1925e751ad0216fe98b6a3db83230c0988 
-CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS               NAMES + 
-3cf093d72b9e        i2tch/mongodb2      "docker-entrypoint...  21 seconds ago      Up 20 seconds              27017/tcp           mongo2 +root@debian11:~# docker ps 
-ea239635e141        testcache           "more /tmp/moment"       hours ago         Exited (0) 6 hours ago                         test1 +CONTAINER ID   IMAGE            COMMAND                  CREATED         STATUS         PORTS       NAMES 
-21b0490a93dd        i2tch/mydocker      "/entrypoint.sh my..."   6 hours ago         Exited (137) 6 hours ago                       myDocker +8b2207df56a7   i2tch/mongodb2   "docker-entrypoint.s…  seconds ago   Up 6 seconds   27017/tcp   mongo2 
-bdb4bc0f81de        i2tch/mongodb1      "docker-entrypoint..."   18 hours ago        Created                    27017/tcp           mongo1 + 
-f5b45072b831        i2tch/mongodb       "bash"                   18 hours ago        Exited (137) 6 hours ago                       mongo +root@debian11:~# docker logs mongo2 
-9731a48f126a        nginx               "nginx -g 'daemon ..."   19 hours ago        Exited (0) 6 hours ago                         cocky_gates +2023-12-15T13:45:40.845+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none' 
-eacd70596e23        nginx               "nginx -g 'daemon ..."   19 hours ago        Exited (0) 19 hours ago                        adoring_yonath +2023-12-15T13:45:40.847+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=8b2207df56a7 
-cffb4456e9c4        ubuntu              "/bin/bash"              19 hours ago        Exited (0) 19 hours ago                        i2tch +2023-12-15T13:45:40.847+0000 I CONTROL  [initandlisten] db version v4.1.9 
-root@debian9:~# docker logs mongo2 +2023-12-15T13:45:40.847+0000 I CONTROL  [initandlisten] git version: a5fa363117062a20d6056c76e01edb3a08f71b7c 
-2017-09-07T08:53:12.523+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=3cf093d72b9e +2023-12-15T13:45:40.847+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.1.1  11 Sep 2018 
-2017-09-07T08:53:12.524+0000 I CONTROL  [initandlisten] db version v3.0.15 +2023-12-15T13:45:40.847+0000 I CONTROL  [initandlisten] allocatortcmalloc 
-2017-09-07T08:53:12.524+0000 I CONTROL  [initandlisten] git version: b8ff507269c382bc100fc52f75f48d54cd42ec3b +2023-12-15T13:45:40.847+0000 I CONTROL  [initandlisten] modules: none 
-2017-09-07T08:53:12.524+0000 I CONTROL  [initandlisten] build infoLinux ip-10-166-66-3 3.2.0-4-amd64 #1 SMP Debian 3.2.46-x86_64 BOOST_LIB_VERSION=1_49 +2023-12-15T13:45:40.847+0000 I CONTROL  [initandlisten] build environment: 
-2017-09-07T08:53:12.524+0000 I CONTROL  [initandlisten] allocatortcmalloc +2023-12-15T13:45:40.847+0000 I CONTROL  [initandlisten]     distmod: ubuntu1804 
-2017-09-07T08:53:12.524+0000 I CONTROL  [initandlisten] options: { storage: { mmapv1{ smallFiles: true } } } +2023-12-15T13:45:40.847+0000 I CONTROL  [initandlisten]     distarch: x86_64 
-2017-09-07T08:53:12.535+0000 I JOURNAL  [initandlisten] journal dir=/data/db/journal +2023-12-15T13:45:40.847+0000 I CONTROL  [initandlisten]     target_archx86_64 
-2017-09-07T08:53:12.535+0000 I JOURNAL  [initandlisten] recover no journal files presentno recovery needed +2023-12-15T13:45:40.847+0000 I CONTROL  [initandlisten] options: { net: { bindIp"*" } } 
-2017-09-07T08:53:13.368+0000 I JOURNAL  [initandlisten] preallocateIsFaster=true 15.4 +2023-12-15T13:45:40.847+0000 I STORAGE  [initandlisten]  
-2017-09-07T08:53:14.410+0000 I JOURNAL  [initandlisten] preallocateIsFaster=true 19.36 +2023-12-15T13:45:40.847+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine 
-2017-09-07T08:53:16.277+0000 I JOURNAL  [initandlisten] preallocateIsFaster=true 15.86 +2023-12-15T13:45:40.847+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem 
-2017-09-07T08:53:16.277+0000 I JOURNAL  [initandlisten] preallocateIsFaster check took 3.742 secs +2023-12-15T13:45:40.847+0000 I STORAGE  [initandlisten] wiredtiger_open configcreate,cache_size=7485M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress), 
-2017-09-07T08:53:16.277+0000 I JOURNAL  [initandlisten] preallocating a journal file /data/db/journal/prealloc.0 +2023-12-15T13:45:41.621+0000 I STORAGE  [initandlisten] WiredTiger message [1702647941:621009][1:0x7f381cfeaa40], txn-recover: Set global recovery timestamp: (0,0) 
-2017-09-07T08:53:19.930+0000 I JOURNAL  [initandlisten] preallocating a journal file /data/db/journal/prealloc.1 +2023-12-15T13:45:41.665+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0) 
-2017-09-07T08:53:23.035+0000 I JOURNAL  [initandlisten] preallocating a journal file /data/db/journal/prealloc.2 +2023-12-15T13:45:41.708+0000 I STORAGE  [initandlisten] Timestamp monitor starting 
-2017-09-07T08:53:25.889+0000 I JOURNAL  [durabilityDurability thread started +2023-12-15T13:45:41.727+0000 I CONTROL  [initandlisten]  
-2017-09-07T08:53:25.889+0000 I JOURNAL  [journal writerJournal writer thread started +2023-12-15T13:45:41.727+0000 I CONTROL  [initandlisten] ** NOTE: This is a development version (4.1.9) of MongoDB
-2017-09-07T08:53:26.016+0000 I INDEX    [initandlisten] allocating new ns file /data/db/local.ns, filling with zeroes... +2023-12-15T13:45:41.727+0000 I CONTROL  [initandlisten] **       Not recommended for production
-2017-09-07T08:53:26.246+0000 I STORAGE  [FileAllocatorallocating new datafile /data/db/local.0, filling with zeroes... +2023-12-15T13:45:41.727+0000 I CONTROL  [initandlisten]  
-2017-09-07T08:53:26.246+0000 I STORAGE  [FileAllocatorcreating directory /data/db/_tmp +2023-12-15T13:45:41.727+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database
-2017-09-07T08:53:26.256+0000 I STORAGE  [FileAllocatordone allocating datafile /data/db/local.0, size16MB,  took 0.002 secs +2023-12-15T13:45:41.727+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted
-2017-09-07T08:53:26.299+0000 I NETWORK  [initandlisten] waiting for connections on port 27017+2023-12-15T13:45:41.727+0000 I CONTROL  [initandlisten]  
 +2023-12-15T13:45:41.727+0000 I CONTROL  [initandlisten]  
 +2023-12-15T13:45:41.727+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'
 +2023-12-15T13:45:41.727+0000 I CONTROL  [initandlisten**        We suggest setting it to 'never' 
 +2023-12-15T13:45:41.727+0000 I CONTROL  [initandlisten]  
 +2023-12-15T13:45:41.728+0000 I STORAGE  [initandlisten] createCollection: admin.system.version with provided UUID: 1e149d35-bbda-46a7-bc8e-3a300abb052f 
 +2023-12-15T13:45:41.815+0000 I INDEX    [initandlisten] index build: done building index _id_ on ns admin.system.version 
 +2023-12-15T13:45:41.815+0000 I SHARDING [initandlisten] Marking collection admin.system.version as collection version: <unsharded> 
 +2023-12-15T13:45:41.815+0000 I COMMAND  [initandlisten] setting featureCompatibilityVersion to 4.2 
 +2023-12-15T13:45:41.819+0000 I SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded> 
 +2023-12-15T13:45:41.819+0000 I SHARDING [initandlisten] Marking collection admin.system.roles as collection version: <unsharded> 
 +2023-12-15T13:45:41.819+0000 I STORAGE  [initandlistencreateCollection: local.startup_log with generated UUID: 759d58f7-7f35-441f-bd93-f090f4a14427 
 +2023-12-15T13:45:41.856+0000 I INDEX    [initandlisten] index build: done building index _id_ on ns local.startup_log 
 +2023-12-15T13:45:41.856+0000 I SHARDING [initandlisten] Marking collection local.startup_log as collection version: <unsharded> 
 +2023-12-15T13:45:41.856+0000 I FTDC     [initandlistenInitializing full-time diagnostic data capture with directory '/data/db/diagnostic.data' 
 +2023-12-15T13:45:41.857+0000 I NETWORK  [initandlistenListening on /tmp/mongodb-27017.sock 
 +2023-12-15T13:45:41.857+0000 I NETWORK  [initandlisten] Listening on 0.0.0.0 
 +2023-12-15T13:45:41.857+0000 I SHARDING [LogicalSessionCacheRefresh] Marking collection config.system.sessions as collection version: <unsharded> 
 +2023-12-15T13:45:41.857+0000 I NETWORK  [initandlisten] waiting for connections on port 27017 
 +2023-12-15T13:45:41.857+0000 I STORAGE  [LogicalSessionCacheRefresh] createCollection: config.system.sessions with generated UUID: 6936ac77-1578-4a80-b907-f00774284e52 
 +2023-12-15T13:45:41.894+0000 I INDEX    [LogicalSessionCacheRefresh] index build: done building index _id_ on ns config.system.sessions 
 +2023-12-15T13:45:41.932+0000 I INDEX    [LogicalSessionCacheRefresh] index build: starting on config.system.sessions properties: { v: 2, key: { lastUse: 1 }, name: "lsidTTLIndex", ns: "config.system.sessions", expireAfterSeconds: 1800 } using method: Hybrid 
 +2023-12-15T13:45:41.932+0000 I INDEX    [LogicalSessionCacheRefresh] build may temporarily use up to 500 megabytes of RAM 
 +2023-12-15T13:45:41.932+0000 I INDEX    [LogicalSessionCacheRefresh] index build: collection scan done. scanned 0 total records in 0 seconds 
 +2023-12-15T13:45:41.932+0000 I INDEX    [LogicalSessionCacheRefresh] index build: inserted 0 keys from external sorter into index in 0 seconds 
 +2023-12-15T13:45:41.933+0000 I INDEX    [LogicalSessionCacheRefresh] index build: done building index lsidTTLIndex on ns config.system.sessions
 </code> </code>
  
Ligne 232: Ligne 244:
  
 <code> <code>
-root@debian9:~# ls -l /var/lib/docker/volumes/+root@debian11:~# ls -l /var/lib/docker/volumes/
 total 68 total 68
-drwxr-xr-x 3 root root  4096 Sep  7 09:43 3bf724ceb38ce0792469d7e403f05b6794f27e0aa72bda51a8ab75b2df5ae87c +drwx-----x 3 root root  4096 Dec 15 14:39 2ec1edeca3acd91aede62091e0d96252eb31e403a00fef324ca2244b2952bb48 
-drwxr-xr-x 3 root root  4096 Sep  6 16:07 46d11d005d05757609ff76159ce0992d210089c5247fa54b024706a20b0de501 +drwx-----x 3 root root  4096 Dec 10 17:12 396ad783162131dcc92a649366ab79e24720bf866ce6803868e2ba2df8e90074 
-drwxr-xr-x 3 root root  4096 Sep  7 09:46 511e23f818d5cf60f4333a3fe8fd2e4333c900dec6eee97f70448bfb0091184d +drwx-----x 3 root root  4096 Dec 15 14:39 4abe232050675d853d0a4d8beefe31f884e1252c985828c3be47a983aac58605 
-drwxr-xr-x 3 root root  4096 Sep  7 09:53 5ca72be4140ecf1271efe7342cf7cd58ce66fc3673d12c04b8503603b8cee66c +drwx-----x 3 root root  4096 Dec 10 17:16 537cc5d0f0f0aa0af9dd959b45fc9fcbe8467a868b9d61919991366a2813f703 
-drwxr-xr-x 3 root root  4096 Sep  7 09:43 76dcc0ccbe6604278cf8e8da0398a807f5d0719087f17c227c8504be24456d43 +drwx-----x 3 root root  4096 Dec 10 17:16 58795fb69d54b87b11fcb6ab752a1fa10736e5aa37c8a14b1c36db1306853a59 
-drwxr-xr-x 3 root root  4096 Sep  7 02:33 9c84c2d1a0db811a3c13dce354ba21169f3073513c8d025dd96c5f902364d44a +drwx-----x 3 root root  4096 Dec 10 18:32 7d7b25232f6ec411dc9dfb888048eebbee919eb2cedc301969bc325a8a8d055e 
-drwxr-xr-x 3 root root  4096 Sep  7 02:33 a6177cf4b46089356280f084dd2e272f673aa4a81accb53f031267fafcee6050 +brw------- 1 root root 8, 33 Dec 15 09:56 backingFsBlockDev 
-drwxr-xr-x 3 root root  4096 Sep  6 16:07 cc38fa97138adc55976aa16993d8920c5f7da922ad1b2a07936d30cc82d59f38 +drwx-----x 3 root root  4096 Dec 10 17:12 f766fb3cd11eee28312b8804c1439c0f7b0a7d58a0ce4d61ba50af17b7630c8f 
--rw------- 1 root root 65536 Sep  7 09:53 metadata.db +drwx-----x 3 root root  4096 Dec 15 14:45 fa3330b3415f534a7d0053ba95d74fe02765cde317c11cac9691c3132cec3d47 
-drwxr-xr-x 3 root root  4096 Sep  7 09:46 persistent_data+-rw------- 1 root root 65536 Dec 15 14:45 metadata.db 
 +drwx-----x 3 root root  4096 Dec 15 14:45 persistent_data
 </code> </code>
  
Ligne 249: Ligne 262:
  
 <code> <code>
-root@debian9:~# docker stop mongo2+root@debian11:~# docker stop mongo2
 mongo2 mongo2
-root@debian9:~# docker rm mongo2+ 
 +root@debian11:~# docker rm mongo2
 mongo2 mongo2
-root@debian9:~# docker run -d --name mongo2 -v persistent_data:/data/db i2tch/mongodb2 + 
-ad672c3038245c25a36162d05820c21f7250557ac342582d0908d3ca33799e37 +root@debian11:~# docker run -d --name mongo2 -v persistent_data:/data/db i2tch/mongodb2 
-root@debian9:~# docker ps -a +cc7cc8f3b43346fe47cc5107225b0b98851a73a9b2938530077ca7a3207581a0 
-CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                     PORTS               NAMES + 
-ad672c303824        i2tch/mongodb2      "docker-entrypoint...  24 seconds ago      Up 22 seconds              27017/tcp           mongo2 +root@debian11:~# docker ps 
-ea239635e141        testcache           "more /tmp/moment"       6 hours ago         Exited (0) 6 hours ago                         test1 +CONTAINER ID   IMAGE            COMMAND                  CREATED          STATUS          PORTS       NAMES 
-21b0490a93dd        i2tch/mydocker      "/entrypoint.sh my..."   6 hours ago         Exited (137) 6 hours ago                       myDocker +cc7cc8f3b433   i2tch/mongodb2   "docker-entrypoint.s…  18 seconds ago   Up 18 seconds   27017/tcp   mongo2
-bdb4bc0f81de        i2tch/mongodb1      "docker-entrypoint..."   18 hours ago        Created                    27017/tcp           mongo1 +
-f5b45072b831        i2tch/mongodb       "bash"                   18 hours ago        Exited (137) 6 hours ago                       mongo +
-9731a48f126a        nginx               "nginx -g 'daemon ..."   19 hours ago        Exited (0) 6 hours ago                         cocky_gates +
-eacd70596e23        nginx               "nginx -g 'daemon ..."   19 hours ago        Exited (0) 19 hours ago                        adoring_yonath +
-cffb4456e9c4        ubuntu              "/bin/bash"              19 hours ago        Exited (0) 19 hours ago                        i2tch+
 </code> </code>
  
Ligne 270: Ligne 279:
  
 <code> <code>
-root@debian9:~# docker inspect mongo2+root@debian11:~# docker inspect mongo2
 ... ...
         "Mounts": [         "Mounts": [
             {             {
                 "Type": "volume",                 "Type": "volume",
-                "Name": "6cefc73cef475279dfe20e25421fa358e6aa995b5c175b9f2c7a9b86163661e5", +                "Name": "persistent_data", 
-                "Source": "/var/lib/docker/volumes/6cefc73cef475279dfe20e25421fa358e6aa995b5c175b9f2c7a9b86163661e5/_data", +                "Source": "/var/lib/docker/volumes/persistent_data/_data", 
-                "Destination": "/data/configdb",+                "Destination": "/data/db",
                 "Driver": "local",                 "Driver": "local",
-                "Mode": "",+                "Mode": "z",
                 "RW": true,                 "RW": true,
                 "Propagation": ""                 "Propagation": ""
Ligne 285: Ligne 294:
             {             {
                 "Type": "volume",                 "Type": "volume",
-                "Name": "persistent_data", +                "Name": "cef4abb286a1b519e6cdfb4a2327659cd124dc1513ed55288c014e61a8bf27b7", 
-                "Source": "/var/lib/docker/volumes/persistent_data/_data", +                "Source": "/var/lib/docker/volumes/cef4abb286a1b519e6cdfb4a2327659cd124dc1513ed55288c014e61a8bf27b7/_data", 
-                "Destination": "/data/db",+                "Destination": "/data/configdb",
                 "Driver": "local",                 "Driver": "local",
-                "Mode": "z",+                "Mode": "",
                 "RW": true,                 "RW": true,
                 "Propagation": ""                 "Propagation": ""
             }             }
 +        ],
 ... ...
 </code> </code>
  
-<WRAP center round important>+<WRAP center round important 50%>
 **Important** : Notez ici que l'utilisation du même répertoire entre les deux conteneurs rend les données persistantes et évite la création de volumes orphelins. Pour plus d'information sur les volumes, consultez la page : **[[https://docs.docker.com/storage/volumes/]]**. **Important** : Notez ici que l'utilisation du même répertoire entre les deux conteneurs rend les données persistantes et évite la création de volumes orphelins. Pour plus d'information sur les volumes, consultez la page : **[[https://docs.docker.com/storage/volumes/]]**.
 </WRAP> </WRAP>
Ligne 303: Ligne 313:
  
 <code> <code>
-root@debian9:~# docker volume create myvolume+root@debian11:~# docker volume create myvolume
 myvolume myvolume
 </code> </code>
Ligne 310: Ligne 320:
  
 <code> <code>
-root@debian9:~# docker volume ls +root@debian11:~# docker volume ls 
-DRIVER              VOLUME NAME +DRIVER    VOLUME NAME 
-local               myvolume+local     2ec1edeca3acd91aede62091e0d96252eb31e403a00fef324ca2244b2952bb48 
 +local     4abe232050675d853d0a4d8beefe31f884e1252c985828c3be47a983aac58605 
 +local     7d7b25232f6ec411dc9dfb888048eebbee919eb2cedc301969bc325a8a8d055e 
 +local     396ad783162131dcc92a649366ab79e24720bf866ce6803868e2ba2df8e90074 
 +local     537cc5d0f0f0aa0af9dd959b45fc9fcbe8467a868b9d61919991366a2813f703 
 +local     58795fb69d54b87b11fcb6ab752a1fa10736e5aa37c8a14b1c36db1306853a59 
 +local     cef4abb286a1b519e6cdfb4a2327659cd124dc1513ed55288c014e61a8bf27b7 
 +local     f766fb3cd11eee28312b8804c1439c0f7b0a7d58a0ce4d61ba50af17b7630c8f 
 +local     fa3330b3415f534a7d0053ba95d74fe02765cde317c11cac9691c3132cec3d47 
 +local     myvolume 
 +local     persistent_data
 </code> </code>
  
Ligne 318: Ligne 338:
  
 <code> <code>
-root@debian9:~# docker volume inspect myvolume+root@debian11:~# docker volume inspect myvolume
 [ [
     {     {
-        "CreatedAt": "2021-04-15T09:35:21+02:00",+        "CreatedAt": "2023-12-15T14:50:18+01:00",
         "Driver": "local",         "Driver": "local",
-        "Labels": {},+        "Labels": null,
         "Mountpoint": "/var/lib/docker/volumes/myvolume/_data",         "Mountpoint": "/var/lib/docker/volumes/myvolume/_data",
         "Name": "myvolume",         "Name": "myvolume",
-        "Options": {},+        "Options": null,
         "Scope": "local"         "Scope": "local"
     }     }
Ligne 335: Ligne 355:
  
 <code> <code>
-root@debian9:~# touch /var/lib/docker/volumes/myvolume/_data/test-file+root@debian11:~# touch /var/lib/docker/volumes/myvolume/_data/test-file
 </code> </code>
  
Ligne 341: Ligne 361:
  
 <code> <code>
-root@debian9:~# docker run -it --name ubuntu-volume --mount source=myvolume,target=/myvolume ubuntu bash +root@debian11:~# docker run -it --name ubuntu-volume --mount source=myvolume,target=/myvolume ubuntu bash
-root@673f9c8bc837:/# ls +
-bin  boot  dev  etc  home  lib  lib32  lib64  libx32  media  mnt  myvolume  opt  proc  root  run  sbin  srv  sys  tmp  usr  var+
 </code> </code>
  
-<WRAP center round important>+<WRAP center round important 50%>
 **Important** : Notez l'utilisation de l'option **--mount** au lieu de l'option **--volume** ou **-v**. Introduit en Docker version 17.06, Docker recommende l'utilisation de l'option --mount plutôt que l'option -v.. **Important** : Notez l'utilisation de l'option **--mount** au lieu de l'option **--volume** ou **-v**. Introduit en Docker version 17.06, Docker recommende l'utilisation de l'option --mount plutôt que l'option -v..
 </WRAP> </WRAP>
Ligne 353: Ligne 371:
  
 <code> <code>
-root@673f9c8bc837:/# cd myvolume/ +root@ff76d3820051:/# cd myvolume/ 
-root@673f9c8bc837:/myvolume# ls+root@ff76d3820051:/myvolume# ls
 test-file test-file
 </code> </code>
Ligne 361: Ligne 379:
  
 <code> <code>
-root@673f9c8bc837:/myvolume# touch container_volume +root@ff76d3820051:/myvolume# touch container_volume 
-root@673f9c8bc837:/myvolume# exit+root@ff76d3820051:/myvolume# exit 
 +exit 
 +root@debian11:~#
 </code> </code>
  
Ligne 368: Ligne 388:
  
 <code> <code>
-root@debian9:~# ls -l /var/lib/docker/volumes/myvolume/_data/+root@debian11:~# ls -l /var/lib/docker/volumes/myvolume/_data/
 total 0 total 0
--rw-r--r-- 1 root root 0 avril 15 10:22 container_volume +-rw-r--r-- 1 root root 0 Dec 15 14:55 container_volume 
--rw-r--r-- 1 root root 0 avril 15 10:16 test-file+-rw-r--r-- 1 root root 0 Dec 15 14:51 test-file
 </code> </code>
  
-<WRAP center round important>+<WRAP center round important 50%>
 **Important** : Notez que les deux fichiers témoins sont visibles. **Important** : Notez que les deux fichiers témoins sont visibles.
 </WRAP> </WRAP>
  
 <code> <code>
-root@debian9:~# docker rm ubuntu-volume+root@debian11:~# docker rm ubuntu-volume
 ubuntu-volume ubuntu-volume
-root@debian9:~# ls -l /var/lib/docker/volumes/myvolume/_data/+ 
 +root@debian11:~# ls -l /var/lib/docker/volumes/myvolume/_data/
 total 0 total 0
--rw-r--r-- 1 root root 0 avril 15 10:22 container_volume +-rw-r--r-- 1 root root 0 Dec 15 14:55 container_volume 
--rw-r--r-- 1 root root 0 avril 15 10:16 test-file+-rw-r--r-- 1 root root 0 Dec 15 14:51 test-file
 </code> </code>
  
-<WRAP center round important>+<WRAP center round important 50%>
 **Important** : Notez que les deux fichiers témoins sont toujours visibles. **Important** : Notez que les deux fichiers témoins sont toujours visibles.
 </WRAP> </WRAP>
Ligne 394: Ligne 415:
  
 <code> <code>
-root@debian9:~# docker run -it --rm --name ubuntu-volume --mount source=myvolume1,target=/myvolume1 ubuntu bash +root@debian11:~# docker run -it --rm --name ubuntu-volume --mount source=myvolume1,target=/myvolume1 ubuntu bash 
-root@b1476960de63:/# ls  + 
-bin  boot  dev  etc  home  lib  lib32  lib64  libx32  media  mnt  myvolume1  opt  proc  root  run  sbin  srv  sys  tmp  usr  var +root@5547f3231534:/# ls 
-root@b1476960de63:/# cd myvolume1 +bin   dev  home  lib32  libx32  mnt        opt   root  sbin  sys  usr 
-root@b1476960de63:/myvolume1# touch file_myvolume1 +boot  etc  lib   lib64  media   myvolume1  proc  run   srv   tmp  var 
-root@b1476960de63:/myvolume1# exit+ 
 +root@5547f3231534:/# cd myvolume1 
 + 
 +root@5547f3231534:/myvolume1# touch file_myvolume1 
 + 
 +root@5547f3231534:/myvolume1# exit
 exit exit
 +root@debian11:~#
 </code> </code>
  
Ligne 406: Ligne 433:
  
 <code> <code>
-root@debian9:~# docker volume ls +root@debian11:~# docker volume ls 
-DRIVER              VOLUME NAME +DRIVER    VOLUME NAME 
-local               myvolume +local     2ec1edeca3acd91aede62091e0d96252eb31e403a00fef324ca2244b2952bb48 
-local               myvolume1 +local     4abe232050675d853d0a4d8beefe31f884e1252c985828c3be47a983aac58605 
-root@debian9:~# ls -l /var/lib/docker/volumes/myvolume1/_data/+local     7d7b25232f6ec411dc9dfb888048eebbee919eb2cedc301969bc325a8a8d055e 
 +local     396ad783162131dcc92a649366ab79e24720bf866ce6803868e2ba2df8e90074 
 +local     537cc5d0f0f0aa0af9dd959b45fc9fcbe8467a868b9d61919991366a2813f703 
 +local     58795fb69d54b87b11fcb6ab752a1fa10736e5aa37c8a14b1c36db1306853a59 
 +local     cef4abb286a1b519e6cdfb4a2327659cd124dc1513ed55288c014e61a8bf27b7 
 +local     f766fb3cd11eee28312b8804c1439c0f7b0a7d58a0ce4d61ba50af17b7630c8f 
 +local     fa3330b3415f534a7d0053ba95d74fe02765cde317c11cac9691c3132cec3d47 
 +local     myvolume 
 +local     myvolume1 
 +local     persistent_data 
 + 
 +root@debian11:~# ls -l /var/lib/docker/volumes/myvolume1/_data/
 total 0 total 0
--rw-r--r-- 1 root root 0 avril 15 12:06 file_myvolume1+-rw-r--r-- 1 root root 0 Dec 15 15:01 file_myvolume1
 </code> </code>
 +
 +====1.3 - Gestion Manuelle d'un Bindmount====
  
 Un autre type de volume utilisable avec Docker est le **Bindmount**. Un Bindmount : Un autre type de volume utilisable avec Docker est le **Bindmount**. Un Bindmount :
Ligne 423: Ligne 463:
  
 <code> <code>
-root@debian9:~# mkdir bindmount +root@debian11:~# mkdir bindmount 
-root@debian9:~# touch bindmount/test_bind+root@debian11:~# touch bindmount/test_bind
 </code> </code>
  
Ligne 430: Ligne 470:
  
 <code> <code>
-root@debian9:~# docker run -it --name ubuntu-volume --mount type=bind,source=/root/bindmount,target=/bindmount ubuntu bash +root@debian11:~# docker run -it --name ubuntu-volume --mount type=bind,source=/root/bindmount,target=/bindmount ubuntu bash 
-root@7b13fe558984:/# ls + 
-bin  bindmount  boot  dev  etc  home  lib  lib32  lib64  libx32  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var +root@1cd3cc50e6c0:/# ls 
-root@7b13fe558984:/# cd bindmount +bin        boot  etc   lib    lib64   media  opt   root  sbin  sys  usr 
-root@7b13fe558984:/bindmount# ls+bindmount  dev   home  lib32  libx32  mnt    proc  run   srv   tmp  var 
 + 
 +root@1cd3cc50e6c0:/# cd bindmount
 + 
 +root@1cd3cc50e6c0:/bindmount# ls
 test_bind test_bind
-root@7b13fe558984:/bindmount# touch container_bind + 
-root@7b13fe558984:/bindmount# ls+root@1cd3cc50e6c0:/bindmount# touch container_bind 
 + 
 +root@1cd3cc50e6c0:/bindmount# ls
 container_bind  test_bind container_bind  test_bind
-root@7b13fe558984:/bindmount# exit+ 
 +root@1cd3cc50e6c0:/bindmount# exit
 exit exit
 +root@debian11:~#
 </code> </code>
  
-Conrôlez la présence du fichier témoin :+Contrôlez la présence du fichier témoin :
  
 <code> <code>
-root@debian9:~# ls -l bindmount/+root@debian11:~# ls -l bindmount/
 total 0 total 0
--rw-r--r-- 1 root root 0 avril 15 10:32 container_bind +-rw-r--r-- 1 root root 0 Dec 15 15:27 container_bind 
--rw-r--r-- 1 root root 0 avril 15 10:32 test_bind +-rw-r--r-- 1 root root 0 Dec 15 15:25 test_bind 
-root@debian9:~# docker rm ubuntu-volume+ 
 +root@debian11:~# docker rm ubuntu-volume
 ubuntu-volume ubuntu-volume
-root@debian9:~# ls -l bindmount/+ 
 +root@debian11:~# ls -l bindmount/
 total 0 total 0
--rw-r--r-- 1 root root 0 avril 15 10:32 container_bind +-rw-r--r-- 1 root root 0 Dec 15 15:27 container_bind 
--rw-r--r-- 1 root root 0 avril 15 10:32 test_bind+-rw-r--r-- 1 root root 0 Dec 15 15:25 test_bind
 </code> </code>
  
Ligne 461: Ligne 511:
  
 <code> <code>
-root@debian9:~# docker volume ls +root@debian11:~# docker volume ls 
-DRIVER              VOLUME NAME +DRIVER    VOLUME NAME 
-local               myvolume+local     2ec1edeca3acd91aede62091e0d96252eb31e403a00fef324ca2244b2952bb48 
 +local     4abe232050675d853d0a4d8beefe31f884e1252c985828c3be47a983aac58605 
 +local     7d7b25232f6ec411dc9dfb888048eebbee919eb2cedc301969bc325a8a8d055e 
 +local     396ad783162131dcc92a649366ab79e24720bf866ce6803868e2ba2df8e90074 
 +local     537cc5d0f0f0aa0af9dd959b45fc9fcbe8467a868b9d61919991366a2813f703 
 +local     58795fb69d54b87b11fcb6ab752a1fa10736e5aa37c8a14b1c36db1306853a59 
 +local     cef4abb286a1b519e6cdfb4a2327659cd124dc1513ed55288c014e61a8bf27b7 
 +local     f766fb3cd11eee28312b8804c1439c0f7b0a7d58a0ce4d61ba50af17b7630c8f 
 +local     fa3330b3415f534a7d0053ba95d74fe02765cde317c11cac9691c3132cec3d47 
 +local     myvolume 
 +local     myvolume1 
 +local     persistent_data
 </code> </code>
- 
  
 =====LAB #2 - Gestion du Réseau===== =====LAB #2 - Gestion du Réseau=====
Ligne 474: Ligne 534:
  
 <code> <code>
-root@debian9:~# docker network ls +root@debian11:~# docker network ls 
-NETWORK ID          NAME                DRIVER              SCOPE +NETWORK ID     NAME      DRIVER    SCOPE 
-495b3db75b0d        bridge              bridge              local +2473b0d9324a   bridge    bridge    local 
-e1ed4de2f947        host                host                local +b0a285caf920   host      host      local 
-6bda460c97c6        none                null                local+a2da9933cdce   none      null      local
 </code> </code>
  
Ligne 488: Ligne 548:
  
 <code> <code>
-root@debian9:~# ip addr show docker0 +root@debian11:~# ip addr show docker0 
-3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default  +3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default  
-    link/ether 02:42:38:f1:e7:ee brd ff:ff:ff:ff:ff:ff+    link/ether 02:42:07:c9:88:32 brd ff:ff:ff:ff:ff:ff
     inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0     inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
 +       valid_lft forever preferred_lft forever
 +    inet6 fe80::42:7ff:fec9:8832/64 scope link 
        valid_lft forever preferred_lft forever        valid_lft forever preferred_lft forever
 </code> </code>
Ligne 498: Ligne 560:
  
 <code> <code>
-root@debian9:~# docker run -itd --name=resotest centos +root@debian11:~# docker run -itd --name=resotest centos 
-2169360fcbfdbd6e68ea969a95edeb6fc42603c23ee42f03ceec286276519855+2126924504d8dedb920728cc7c2a6c73e87f8c5c3d13c17c4fcc2bfe8ff93cc9
 </code> </code>
  
Ligne 505: Ligne 567:
  
 <code> <code>
-root@debian9:~# docker network inspect bridge+root@debian11:~# docker network inspect bridge
 [ [
     {     {
         "Name": "bridge",         "Name": "bridge",
-        "Id": "495b3db75b0d4bfcfc6da7c3e2af5f6addcdc227aa8b69b1e59a998be1819d12", +        "Id": "2473b0d9324a421018cdf501060801d34c599991bed76751ae328bc68126a180", 
-        "Created": "2017-09-07T07:44:49.942615596+01:00",+        "Created": "2023-12-15T09:56:50.183135221+01:00",
         "Scope": "local",         "Scope": "local",
         "Driver": "bridge",         "Driver": "bridge",
Ligne 532: Ligne 594:
         "ConfigOnly": false,         "ConfigOnly": false,
         "Containers": {         "Containers": {
-            "2169360fcbfdbd6e68ea969a95edeb6fc42603c23ee42f03ceec286276519855": {+            "2126924504d8dedb920728cc7c2a6c73e87f8c5c3d13c17c4fcc2bfe8ff93cc9": {
                 "Name": "resotest",                 "Name": "resotest",
-                "EndpointID": "fc74e519d69b9a2112be959c92cda22b67671b52efbbd36fadf66097ccbb1271",+                "EndpointID": "e9ae0ba15d4588571fe77a9a8e1564e92620f9532bed8ee38d060b954116b20c",
                 "MacAddress": "02:42:ac:11:00:03",                 "MacAddress": "02:42:ac:11:00:03",
                 "IPv4Address": "172.17.0.3/16",                 "IPv4Address": "172.17.0.3/16",
                 "IPv6Address": ""                 "IPv6Address": ""
             },             },
-            "ad672c3038245c25a36162d05820c21f7250557ac342582d0908d3ca33799e37": {+            "cc7cc8f3b43346fe47cc5107225b0b98851a73a9b2938530077ca7a3207581a0": {
                 "Name": "mongo2",                 "Name": "mongo2",
-                "EndpointID": "adc15132fb73b57ab14e960feeff1b965321ada411be8535b715b103b941d8cc",+                "EndpointID": "d9f30326f473f12a45f6aacf97cee0f12c9c545e45ed7808b0cba809fa48ae9a",
                 "MacAddress": "02:42:ac:11:00:02",                 "MacAddress": "02:42:ac:11:00:02",
                 "IPv4Address": "172.17.0.2/16",                 "IPv4Address": "172.17.0.2/16",
Ligne 560: Ligne 622:
 </code> </code>
  
-<WRAP center round important>+<WRAP center round important 50%>
 **Important** : Notez ici que les conteneurs **mongo2** et **resotest** ne disposent pas de la même adresse que l'interface **docker0** de la machine hôte. Cependant les adresses se trouvent dans le même segment - **172.17.0.0/16** indiqué par la sortie **"Subnet": "172.17.0.0/16"**. **Important** : Notez ici que les conteneurs **mongo2** et **resotest** ne disposent pas de la même adresse que l'interface **docker0** de la machine hôte. Cependant les adresses se trouvent dans le même segment - **172.17.0.0/16** indiqué par la sortie **"Subnet": "172.17.0.0/16"**.
 </WRAP> </WRAP>
Ligne 567: Ligne 629:
  
 <code> <code>
-root@debian9:~# docker network disconnect bridge resotest +root@debian11:~# docker network disconnect bridge resotest 
-root@debian9:~# docker network inspect bridge+ 
 +root@debian11:~# docker network inspect bridge
 [ [
     {     {
         "Name": "bridge",         "Name": "bridge",
-        "Id": "495b3db75b0d4bfcfc6da7c3e2af5f6addcdc227aa8b69b1e59a998be1819d12", +        "Id": "2473b0d9324a421018cdf501060801d34c599991bed76751ae328bc68126a180", 
-        "Created": "2017-09-07T07:44:49.942615596+01:00",+        "Created": "2023-12-15T09:56:50.183135221+01:00",
         "Scope": "local",         "Scope": "local",
         "Driver": "bridge",         "Driver": "bridge",
Ligne 595: Ligne 658:
         "ConfigOnly": false,         "ConfigOnly": false,
         "Containers": {         "Containers": {
-            "ad672c3038245c25a36162d05820c21f7250557ac342582d0908d3ca33799e37": {+            "cc7cc8f3b43346fe47cc5107225b0b98851a73a9b2938530077ca7a3207581a0": {
                 "Name": "mongo2",                 "Name": "mongo2",
-                "EndpointID": "adc15132fb73b57ab14e960feeff1b965321ada411be8535b715b103b941d8cc",+                "EndpointID": "d9f30326f473f12a45f6aacf97cee0f12c9c545e45ed7808b0cba809fa48ae9a",
                 "MacAddress": "02:42:ac:11:00:02",                 "MacAddress": "02:42:ac:11:00:02",
                 "IPv4Address": "172.17.0.2/16",                 "IPv4Address": "172.17.0.2/16",
Ligne 619: Ligne 682:
  
 <code> <code>
-root@debian9:~# docker network create -d bridge --subnet 172.25.0.0/16 --gateway 172.25.0.1 my-bridged-network +root@debian11:~# docker network create -d bridge --subnet 172.25.0.0/16 --gateway 172.25.0.1 my-bridged-network 
-ceb7ba7493933c55d181bc92b1f799ca07bfe84b168d52a6ac648c1a906093f3 +4d26c1192dd7b25c3c787ef41b7bfb94d0eb989d230f33906db6d54ed9c128cc 
-root@debian9:~# docker network ls + 
-NETWORK ID          NAME                 DRIVER              SCOPE +root@debian11:~# docker network ls 
-495b3db75b0d        bridge               bridge              local +NETWORK ID     NAME                 DRIVER    SCOPE 
-e1ed4de2f947        host                 host                local +2473b0d9324a   bridge               bridge    local 
-ceb7ba749393        my-bridged-network   bridge              local +b0a285caf920   host                 host      local 
-6bda460c97c6        none                 null                local             +4d26c1192dd7   my-bridged-network   bridge    local 
 +a2da9933cdce   none                 null      local           
 </code> </code>
  
Ligne 632: Ligne 696:
  
 <code> <code>
-root@debian9:~# docker network inspect my-bridged-network+root@debian11:~# docker network inspect my-bridged-network
 [ [
     {     {
         "Name": "my-bridged-network",         "Name": "my-bridged-network",
-        "Id": "ceb7ba7493933c55d181bc92b1f799ca07bfe84b168d52a6ac648c1a906093f3", +        "Id": "4d26c1192dd7b25c3c787ef41b7bfb94d0eb989d230f33906db6d54ed9c128cc", 
-        "Created": "2017-09-07T10:03:17.063730665+01:00",+        "Created": "2023-12-15T15:34:02.824127656+01:00",
         "Scope": "local",         "Scope": "local",
         "Driver": "bridge",         "Driver": "bridge",
Ligne 668: Ligne 732:
  
 <code> <code>
-root@debian9:~# docker run -itd --name=centos1 centos +root@debian11:~# docker run -itd --name=centos1 centos 
-9f36a628c72b383edfd4dc13ee4e4b2eaf5be0078d780f0334fcb8be0d977d0e+cb2875ab1059e66308228d9179b810db748ad287453cf758206a7025f57b0176
  
-root@debian9:~# docker run -itd --name=centos2 centos +root@debian11:~# docker run -itd --name=centos2 centos 
-aaed3bc8e404ee1bccd6c87b39de32332940b5391514691fc70188edb17c1d7c+fc417b22a20d3f9de674889962452bfe453ced1fc389410b225055f865cb817f
  
-root@debian9:~# docker inspect --format='{{json .NetworkSettings.Networks}}'  centos1 +root@debian11:~# docker inspect --format='{{json .NetworkSettings.Networks}}'  centos1 
-{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"495b3db75b0d4bfcfc6da7c3e2af5f6addcdc227aa8b69b1e59a998be1819d12","EndpointID":"d7b87875688b45258fc867b6bb8b0a0592f5c5fa16857fe136e55b87b6698219","Gateway":"172.17.0.1","IPAddress":"172.17.0.3","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:03","DriverOpts":null}}+{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"2473b0d9324a421018cdf501060801d34c599991bed76751ae328bc68126a180","EndpointID":"a0e5d67f4652be807583fba65a76bf1a0462200aa198c92ab29845f88c45d559","Gateway":"172.17.0.1","IPAddress":"172.17.0.3","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:03","DriverOpts":null}}
  
-root@debian9:~# docker inspect --format='{{json .NetworkSettings.Networks}}'  centos2 +root@debian11:~# docker inspect --format='{{json .NetworkSettings.Networks}}'  centos2 
-{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"495b3db75b0d4bfcfc6da7c3e2af5f6addcdc227aa8b69b1e59a998be1819d12","EndpointID":"2bfe090dccef89495d437d8deba5765996a917544ab7fde28ef5199f4e907eb1","Gateway":"172.17.0.1","IPAddress":"172.17.0.4","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:04","DriverOpts":null}}+{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"2473b0d9324a421018cdf501060801d34c599991bed76751ae328bc68126a180","EndpointID":"15ed4b05703524f64015b12683ea01729dd26a7dfe68ab638383ea075d8d1428","Gateway":"172.17.0.1","IPAddress":"172.17.0.4","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:04","DriverOpts":null}}
  
-root@debian9:~# docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' centos1+root@debian11:~# docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' centos1
 172.17.0.3 172.17.0.3
  
-root@debian9:~# docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' centos2+root@debian11:~# docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' centos2
 172.17.0.4 172.17.0.4
 </code> </code>
Ligne 690: Ligne 754:
  
 <code> <code>
-root@debian9:~# docker network connect my-bridged-network centos1+root@debian11:~# docker network connect my-bridged-network centos1
  
-root@debian9:~# docker network inspect my-bridged-network+root@debian11:~# docker network inspect my-bridged-network
 [ [
     {     {
         "Name": "my-bridged-network",         "Name": "my-bridged-network",
-        "Id": "ceb7ba7493933c55d181bc92b1f799ca07bfe84b168d52a6ac648c1a906093f3", +        "Id": "4d26c1192dd7b25c3c787ef41b7bfb94d0eb989d230f33906db6d54ed9c128cc", 
-        "Created": "2017-09-07T10:03:17.063730665+01:00",+        "Created": "2023-12-15T15:34:02.824127656+01:00",
         "Scope": "local",         "Scope": "local",
         "Driver": "bridge",         "Driver": "bridge",
Ligne 719: Ligne 783:
         "ConfigOnly": false,         "ConfigOnly": false,
         "Containers": {         "Containers": {
-            "9f36a628c72b383edfd4dc13ee4e4b2eaf5be0078d780f0334fcb8be0d977d0e": {+            "cb2875ab1059e66308228d9179b810db748ad287453cf758206a7025f57b0176": {
                 "Name": "centos1",                 "Name": "centos1",
-                "EndpointID": "71e10e4e34ce8c42ef029e302f6ed372357f6fde8fd87fc2cbc1b14c2bdf6bb5",+                "EndpointID": "a7de8c07d195168c20548b33b506073caa03c16770f330a2e576aedcda25662c",
                 "MacAddress": "02:42:ac:19:00:02",                 "MacAddress": "02:42:ac:19:00:02",
                 "IPv4Address": "172.25.0.2/16",                 "IPv4Address": "172.25.0.2/16",
Ligne 732: Ligne 796:
 ] ]
  
-root@debian9:~# docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' centos1+root@debian11:~# docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' centos1
 172.17.0.3172.25.0.2 172.17.0.3172.25.0.2
 </code> </code>
  
-<WRAP center round important>+<WRAP center round important 50%>
 **Important** : Notez  que le conteneur **centos1** se trouve dans deux réseaux. **Important** : Notez  que le conteneur **centos1** se trouve dans deux réseaux.
 </WRAP> </WRAP>
Ligne 743: Ligne 807:
  
 <code> <code>
-root@debian9:~# docker network connect my-bridged-network centos2+root@debian11:~# docker network connect my-bridged-network centos2
  
-root@debian9:~# docker network inspect my-bridged-network+root@debian11:~# docker network inspect my-bridged-network
 [ [
     {     {
         "Name": "my-bridged-network",         "Name": "my-bridged-network",
-        "Id": "ceb7ba7493933c55d181bc92b1f799ca07bfe84b168d52a6ac648c1a906093f3", +        "Id": "4d26c1192dd7b25c3c787ef41b7bfb94d0eb989d230f33906db6d54ed9c128cc", 
-        "Created": "2017-09-07T10:03:17.063730665+01:00",+        "Created": "2023-12-15T15:34:02.824127656+01:00",
         "Scope": "local",         "Scope": "local",
         "Driver": "bridge",         "Driver": "bridge",
Ligne 772: Ligne 836:
         "ConfigOnly": false,         "ConfigOnly": false,
         "Containers": {         "Containers": {
-            "9f36a628c72b383edfd4dc13ee4e4b2eaf5be0078d780f0334fcb8be0d977d0e": {+            "cb2875ab1059e66308228d9179b810db748ad287453cf758206a7025f57b0176": {
                 "Name": "centos1",                 "Name": "centos1",
-                "EndpointID": "71e10e4e34ce8c42ef029e302f6ed372357f6fde8fd87fc2cbc1b14c2bdf6bb5",+                "EndpointID": "a7de8c07d195168c20548b33b506073caa03c16770f330a2e576aedcda25662c",
                 "MacAddress": "02:42:ac:19:00:02",                 "MacAddress": "02:42:ac:19:00:02",
                 "IPv4Address": "172.25.0.2/16",                 "IPv4Address": "172.25.0.2/16",
                 "IPv6Address": ""                 "IPv6Address": ""
             },             },
-            "aaed3bc8e404ee1bccd6c87b39de32332940b5391514691fc70188edb17c1d7c": {+            "fc417b22a20d3f9de674889962452bfe453ced1fc389410b225055f865cb817f": {
                 "Name": "centos2",                 "Name": "centos2",
-                "EndpointID": "34f533622f134b995097f1d3e6ce935158c1e5644201f896b42336738a81819c",+                "EndpointID": "8467b7d4233dbf855d0538dbc9b1fe718874434913baae403391b3da81ccb92b",
                 "MacAddress": "02:42:ac:19:00:03",                 "MacAddress": "02:42:ac:19:00:03",
                 "IPv4Address": "172.25.0.3/16",                 "IPv4Address": "172.25.0.3/16",
Ligne 792: Ligne 856:
 ] ]
  
-root@debian9:~# docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' centos2+root@debian11:~# docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' centos2
 172.17.0.4172.25.0.3 172.17.0.4172.25.0.3
 </code> </code>
Ligne 799: Ligne 863:
  
 <code> <code>
-root@debian9:~# docker exec -it centos1 bash+root@debian11:~# docker exec -it centos1 bash 
 +[root@cb2875ab1059 /]#
 </code> </code>
  
Ligne 805: Ligne 870:
  
 <code> <code>
-[root@9f36a628c72b /]# ping 172.25.0.3+[root@cb2875ab1059 /]# ping 172.25.0.3
 PING 172.25.0.3 (172.25.0.3) 56(84) bytes of data. PING 172.25.0.3 (172.25.0.3) 56(84) bytes of data.
-64 bytes from 172.25.0.3: icmp_seq=1 ttl=64 time=0.100 ms +64 bytes from 172.25.0.3: icmp_seq=1 ttl=64 time=0.140 ms 
-64 bytes from 172.25.0.3: icmp_seq=2 ttl=64 time=0.050 ms +64 bytes from 172.25.0.3: icmp_seq=2 ttl=64 time=0.099 ms
-64 bytes from 172.25.0.3: icmp_seq=3 ttl=64 time=0.050 ms+
 ^C ^C
 --- 172.25.0.3 ping statistics --- --- 172.25.0.3 ping statistics ---
-packets transmitted, received, 0% packet loss, time 1998ms +packets transmitted, received, 0% packet loss, time 1021ms 
-rtt min/avg/max/mdev = 0.050/0.066/0.100/0.025 ms+rtt min/avg/max/mdev = 0.099/0.119/0.140/0.023 ms
 </code> </code>
  
Ligne 821: Ligne 885:
  
 <code> <code>
-[root@9f36a628c72b /]# exit+[root@cb2875ab1059 /]# exit
 exit exit
-root@debian9:~# docker stop mongo2+ 
 +root@debian11:~# docker stop mongo2
 mongo2 mongo2
-root@debian9:~# docker rm mongo2+ 
 +root@debian11:~# docker rm mongo2
 mongo2 mongo2
-root@debian9:~# docker run -it --name mongo2 --dns 8.8.8.8 i2tch/mongodb2 bash + 
-root@735599480b45:/# cat /etc/resolv.conf  +root@debian11:~# docker run -it --name mongo2 --dns 8.8.8.8 i2tch/mongodb2 bash 
-search home+ 
 +root@aa2717305397:/# cat /etc/resolv.conf
 nameserver 8.8.8.8 nameserver 8.8.8.8
-root@735599480b45:/#  
 </code> </code>
  
Ligne 837: Ligne 903:
  
 <code> <code>
-root@735599480b45:/# exit+root@aa2717305397:/# exit
 exit exit
-root@debian9:~# docker stop mongo2+ 
 +root@debian11:~# docker stop mongo2
 mongo2 mongo2
-root@debian9:~# docker rm mongo2+ 
 +root@debian11:~# docker rm mongo2
 mongo2 mongo2
-root@debian9:~# docker run -it --name mongo2 --add-host mickeymouse:127.0.0.1 i2tch/mongodb2 bash + 
-root@718e7eab814f:/# cat /etc/hosts +root@debian11:~# docker run -it --name mongo2 --add-host mickeymouse:127.0.0.1 i2tch/mongodb2 bash 
-127.0.0.1 localhost +root@519423c7fb32:/# cat /etc/hosts 
-::1 localhost ip6-localhost ip6-loopback +127.0.0.1       localhost 
-fe00::0 ip6-localnet +::1     localhost ip6-localhost ip6-loopback 
-ff00::0 ip6-mcastprefix +fe00::0 ip6-localnet 
-ff02::1 ip6-allnodes +ff00::0 ip6-mcastprefix 
-ff02::2 ip6-allrouters +ff02::1 ip6-allnodes 
-127.0.0.1 mickeymouse +ff02::2 ip6-allrouters 
-172.17.0.2 718e7eab814f+127.0.0.1       mickeymouse 
 +172.17.0.2      519423c7fb32 
 + 
 +root@519423c7fb32:/# exit 
 +exit 
 +root@debian11:~# 
 </code> </code>
  
Ligne 859: Ligne 932:
 Ce type de réseau est utilisé dans le cas où le réseau ne doit pas être isolé de l'hôte tout en isolant les autres aspects du conteneur. Les conteneurs utilisent la même interface que l'hôte en prenant la même adresse IP que la machine hôte. Ce type de réseau est utilisé dans le cas où le réseau ne doit pas être isolé de l'hôte tout en isolant les autres aspects du conteneur. Les conteneurs utilisent la même interface que l'hôte en prenant la même adresse IP que la machine hôte.
  
-Dans le cas de la machine virtuelle, l'adresse IP de l'interface connectée au réseau local est **10.0.2.60** :+Dans le cas de la machine virtuelle, l'adresse IP de l'interface connectée au réseau local est **10.0.2.46** :
  
 <code> <code>
-root@debian9:~# ip addr show ens18+root@debian11:~# ip addr show ens18
 2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
-    link/ether 08:00:27:2e:77:01 brd ff:ff:ff:ff:ff:ff +    link/ether 56:a3:fd:18:02:6d brd ff:ff:ff:ff:ff:ff 
-    inet 10.0.2.60/24 brd 10.0.2.255 scope global dynamic ens18 +    altname enp0s18 
-       valid_lft 83772sec preferred_lft 83772sec +    inet 10.0.2.46/24 brd 10.0.2.255 scope global noprefixroute ens18 
-    inet6 fe80::a00:27ff:fe2e:7701/64 scope link +       valid_lft forever preferred_lft forever 
 +    inet6 fe80::54a3:fdff:fe18:26d/64 scope link noprefixroute 
        valid_lft forever preferred_lft forever        valid_lft forever preferred_lft forever
 </code> </code>
Ligne 874: Ligne 948:
  
 <code> <code>
-root@debian9:~# docker run -it --rm --network host --name centos3 centos bash +root@debian11:~# docker run -it --rm --network host --name centos3 centos bash 
-[root@debian9 /]# ip a + 
-1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1+[root@debian11 /]# ip a 
 +1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
     inet 127.0.0.1/8 scope host lo     inet 127.0.0.1/8 scope host lo
Ligne 883: Ligne 958:
        valid_lft forever preferred_lft forever        valid_lft forever preferred_lft forever
 2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
-    link/ether 08:00:27:2e:77:01 brd ff:ff:ff:ff:ff:ff +    link/ether 56:a3:fd:18:02:6d brd ff:ff:ff:ff:ff:ff 
-    inet 10.0.2.60/24 brd 10.0.2.255 scope global dynamic ens18 +    altname enp0s18 
-       valid_lft 82102sec preferred_lft 82102sec +    inet 10.0.2.46/24 brd 10.0.2.255 scope global noprefixroute ens18
-    inet6 fe80::a00:27ff:fe2e:7701/64 scope link +
        valid_lft forever preferred_lft forever        valid_lft forever preferred_lft forever
-3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default  +    inet6 fe80::54a3:fdff:fe18:26d/64 scope link noprefixroute  
-    link/ether 02:42:38:f1:e7:ee brd ff:ff:ff:ff:ff:ff+       valid_lft forever preferred_lft forever 
 +3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default  
 +    link/ether 02:42:07:c9:88:32 brd ff:ff:ff:ff:ff:ff
     inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0     inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
        valid_lft forever preferred_lft forever        valid_lft forever preferred_lft forever
-    inet6 fe80::42:38ff:fef1:e7ee/64 scope link +    inet6 fe80::42:7ff:fec9:8832/64 scope link 
        valid_lft forever preferred_lft forever        valid_lft forever preferred_lft forever
-[root@debian9 /]# hostname +102: br-4d26c1192dd7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default  
-debian9 +    link/ether 02:42:2d:69:ac:d5 brd ff:ff:ff:ff:ff:ff 
-[root@debian9 /]# exit+    inet 172.25.0.1/16 brd 172.25.255.255 scope global br-4d26c1192dd7 
 +       valid_lft forever preferred_lft forever 
 +    inet6 fe80::42:2dff:fe69:acd5/64 scope link  
 +       valid_lft forever preferred_lft forever 
 +104: vethc5ca04a@if103: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default  
 +    link/ether 42:98:9a:1c:41:76 brd ff:ff:ff:ff:ff:ff link-netnsid 2 
 +    inet6 fe80::4098:9aff:fe1c:4176/64 scope link  
 +       valid_lft forever preferred_lft forever 
 +106: veth6a46250@if105: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default  
 +    link/ether 5e:9d:9a:86:23:b0 brd ff:ff:ff:ff:ff:ff link-netnsid 3 
 +    inet6 fe80::5c9d:9aff:fe86:23b0/64 scope link  
 +       valid_lft forever preferred_lft forever 
 +108: vethc5ccfca@if107: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-4d26c1192dd7 state UP group default  
 +    link/ether f2:37:cb:08:ff:8f brd ff:ff:ff:ff:ff:ff link-netnsid 2 
 +    inet6 fe80::f037:cbff:fe08:ff8f/64 scope link  
 +       valid_lft forever preferred_lft forever 
 +110: vetha87ff61@if109: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-4d26c1192dd7 state UP group default  
 +    link/ether 2e:e0:2d:5c:5d:c7 brd ff:ff:ff:ff:ff:ff link-netnsid 3 
 +    inet6 fe80::2ce0:2dff:fe5c:5dc7/64 scope link  
 +       valid_lft forever preferred_lft forever 
 + 
 +[root@debian11 /]# hostname 
 +debian11 
 + 
 +[root@debian11 /]# exit 
 +exit 
 +root@debian11:~#
 </code> </code>
  
-Le but de ce type de réseau est de permettre l'accès à des services dans le conteneur directement à partir de l'adresse IP de l'hôte Docker. Par exemple, un nginx dans le conteneur pourrait être joint directement sur 10.0.2.60:80 **sans** avoir besoin de passer par l'exposition du port. +Le but de ce type de réseau est de permettre l'accès à des services dans le conteneur directement à partir de l'adresse IP de l'hôte Docker. Par exemple, un nginx dans le conteneur pourrait être joint directement sur 10.0.2.46:80 **sans** avoir besoin de passer par l'exposition du port. 
  
 Pour cette raison, dans le cas de l'option **-p** utilisé dans la cas du réseau **host**, cette option n'est pas prise en compte et produit l'avertissement **WARNING: Published ports are discarded when using host network mode**. L'utilité majeure donc du réseau **host** se trouve dans le cas où de multiples ports dans le conteneur doivent être joignables. Pour cette raison, dans le cas de l'option **-p** utilisé dans la cas du réseau **host**, cette option n'est pas prise en compte et produit l'avertissement **WARNING: Published ports are discarded when using host network mode**. L'utilité majeure donc du réseau **host** se trouve dans le cas où de multiples ports dans le conteneur doivent être joignables.
Ligne 914: Ligne 1016:
  
 <code> <code>
-root@718e7eab814f:/# exit +root@debian11:~# docker stop mongo2
-exit +
-root@debian9:~# docker stop mongo2+
 mongo2 mongo2
-root@debian9:~# docker rm mongo2+root@debian11:~# docker rm mongo2
 mongo2 mongo2
-root@debian9:~# docker run -it --name mongo2 --network none i2tch/mongodb2 bash +root@debian11:~# docker run -it --name mongo2 --network none i2tch/mongodb2 bash 
-root@332aa9930f30:/#  +root@5bfbf0306ad7:/#
-</code>+
  
 ===Liens=== ===Liens===
Ligne 950: Ligne 1049:
 cffb4456e9c4        ubuntu              "/bin/bash"              20 hours ago        Exited (0) 20 hours ago                           i2tch cffb4456e9c4        ubuntu              "/bin/bash"              20 hours ago        Exited (0) 20 hours ago                           i2tch
  
-root@debian9:~# docker exec -it centos3 bash+root@debian11:~# docker exec -it centos3 bash
  
-[root@6a315259b294 /]# ping centos2+[root@57e92a8b25d7 /]# ping centos2
 PING alias (172.17.0.4) 56(84) bytes of data. PING alias (172.17.0.4) 56(84) bytes of data.
-64 bytes from alias (172.17.0.4): icmp_seq=1 ttl=64 time=0.116 ms +64 bytes from alias (172.17.0.4): icmp_seq=1 ttl=64 time=0.146 ms 
-64 bytes from alias (172.17.0.4): icmp_seq=2 ttl=64 time=0.069 ms +64 bytes from alias (172.17.0.4): icmp_seq=2 ttl=64 time=0.088 ms 
-64 bytes from alias (172.17.0.4): icmp_seq=3 ttl=64 time=0.068 ms+64 bytes from alias (172.17.0.4): icmp_seq=3 ttl=64 time=0.081 ms
 64 bytes from alias (172.17.0.4): icmp_seq=4 ttl=64 time=0.070 ms 64 bytes from alias (172.17.0.4): icmp_seq=4 ttl=64 time=0.070 ms
 ^C ^C
 --- alias ping statistics --- --- alias ping statistics ---
-4 packets transmitted, 4 received, 0% packet loss, time 2999ms +4 packets transmitted, 4 received, 0% packet loss, time 3079ms 
-rtt min/avg/max/mdev = 0.068/0.080/0.116/0.023 ms+rtt min/avg/max/mdev = 0.070/0.096/0.146/0.030 ms
  
-[root@6a315259b294 /]# cat /etc/hosts +[root@57e92a8b25d7 /]# cat /etc/hosts 
-127.0.0.1 localhost +127.0.0.1       localhost 
-::1 localhost ip6-localhost ip6-loopback +::1     localhost ip6-localhost ip6-loopback 
-fe00::0 ip6-localnet +fe00::0 ip6-localnet 
-ff00::0 ip6-mcastprefix +ff00::0 ip6-mcastprefix 
-ff02::1 ip6-allnodes +ff02::1 ip6-allnodes 
-ff02::2 ip6-allrouters +ff02::2 ip6-allrouters 
-172.17.0.4 alias aaed3bc8e404 centos2 +172.17.0.4      alias fc417b22a20d centos2 
-172.17.0.2 6a315259b294+172.17.0.2      57e92a8b25d7
  
-[root@6a315259b294 /]# exit+[root@57e92a8b25d7 /]# exit
 exit exit
 +root@debian11:~#
  
-root@debian9:~# docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' centos3+root@debian11:~# docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' centos3
 172.17.0.2 172.17.0.2
 </code> </code>
Ligne 983: Ligne 1083:
  
 <code> <code>
-root@debian9:~# docker exec -it centos2 bash+root@debian11:~# docker exec -it centos2 bash
  
-[root@aaed3bc8e404 /]# ping centos3+[root@fc417b22a20d /]# ping centos3
 ping: centos3: Name or service not known ping: centos3: Name or service not known
  
-[root@aaed3bc8e404 /]# ping 172.17.0.2+[root@fc417b22a20d /]# ping 172.17.0.2
 PING 172.17.0.2 (172.17.0.2) 56(84) bytes of data. PING 172.17.0.2 (172.17.0.2) 56(84) bytes of data.
-64 bytes from 172.17.0.2: icmp_seq=1 ttl=64 time=0.054 ms +64 bytes from 172.17.0.2: icmp_seq=1 ttl=64 time=0.097 ms 
-64 bytes from 172.17.0.2: icmp_seq=2 ttl=64 time=0.035 ms +64 bytes from 172.17.0.2: icmp_seq=2 ttl=64 time=0.082 ms 
-64 bytes from 172.17.0.2: icmp_seq=3 ttl=64 time=0.051 ms +64 bytes from 172.17.0.2: icmp_seq=3 ttl=64 time=0.125 ms
-64 bytes from 172.17.0.2: icmp_seq=4 ttl=64 time=0.071 ms+
 ^C ^C
 --- 172.17.0.2 ping statistics --- --- 172.17.0.2 ping statistics ---
-packets transmitted, received, 0% packet loss, time 2997ms +packets transmitted, received, 0% packet loss, time 2029ms 
-rtt min/avg/max/mdev = 0.035/0.052/0.071/0.015 ms +rtt min/avg/max/mdev = 0.082/0.101/0.125/0.019 ms
- +
-[root@aaed3bc8e404 /]# +
 </code> </code>
  
Ligne 1005: Ligne 1102:
  
 <code> <code>
-[root@aaed3bc8e404 /]# exit+[root@fc417b22a20d /]# exit
 exit exit
-root@debian9:~# docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' centos2+ 
 +root@debian11:~# docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' centos2
 172.17.0.4172.25.0.3 172.17.0.4172.25.0.3
 </code> </code>
Ligne 1016: Ligne 1114:
  
 <code> <code>
-root@debian9:~# mkdir ~/wordpress && cd ~/wordpress+root@debian11:~# mkdir ~/wordpress && cd ~/wordpress
 </code> </code>
  
Ligne 1022: Ligne 1120:
  
 <code> <code>
-root@debian9:~/wordpress# docker run -e MYSQL_ROOT_PASSWORD=fenestros -e MYSQL_DATABASE=wordpress --name wordpressdb -v "$PWD/database":/var/lib/mysql -d mysql:latest +root@debian11:~/wordpress# docker run -e MYSQL_ROOT_PASSWORD=fenestros -e MYSQL_DATABASE=wordpress --name wordpressdb -v "$PWD/database":/var/lib/mysql -d mysql:latest 
-Unable to find image 'mariadb:latest' locally +Unable to find image 'mysql:latest' locally 
-latest: Pulling from library/mariadb +latest: Pulling from library/mysql 
-f2b6b4884fc8: Pull complete  +e9f2695d7e5b: Pull complete  
-26d8bdca4f3e: Pull complete  +80c6055edb33: Pull complete  
-74f09e820cce: Pull complete  +c646ab461d8b: Pull complete  
-5390f1fe4554: Pull complete  +012006c6a591: Pull complete  
-3d3f1706a741: Pull complete  +929d5fa34b95: Pull complete  
-2942f66426ea: Pull complete  +17e0243877fa: Pull complete  
-97ee11d39c75: Pull complete  +1850b459cd2f: Pull complete  
-590c46ef722b: Pull complete  +8dceaed53baf: Pull complete  
-32eb4b9666e5: Pull complete  +197b834ea1cd: Pull complete  
-fc883f98a064: Pull complete  +8df78c25b227: Pull complete  
-bb8bee61bc1e: Pull complete  +Digest: sha256:ceb98918916bd5261b3e9866ac8271d75d276b8a4db56f1dc190770342a77a9b 
-Digest: sha256:6135f5b851e7fe263dcf0edf3480cdab1ab28c4287e867c5d83fbe967412ea14 +Status: Downloaded newer image for mysql:latest 
-Status: Downloaded newer image for mariadb:latest +db3732939266ed8a112857db9c970ca39571785e62db74175bda9be5a0f9d726
-67831dacf002bdc21dc79b0e8483f538235d00ddd2e8aae175ef3ebf189ae14d+
 </code> </code>
  
Ligne 1044: Ligne 1141:
  
 <code> <code>
-root@debian9:~/wordpress# docker ps +root@debian11:~/wordpress# docker ps 
-CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS               NAMES +CONTAINER ID   IMAGE          COMMAND                  CREATED              STATUS          PORTS                 NAMES 
-67831dacf002        mariadb:latest      "docker-entrypoint.s…"   About a minute ago   Up 45 seconds       3306/tcp            wordpressdb+db3732939266   mysql:latest   "docker-entrypoint.s…"   About a minute ago   Up 52 seconds   3306/tcp, 33060/tcp   wordpressdb 
 +57e92a8b25d7   centos         "/bin/bash"              12 minutes ago       Up 12 minutes                         centos3 
 +fc417b22a20d   centos         "/bin/bash"              25 minutes ago       Up 25 minutes                         centos2 
 +cb2875ab1059   centos         "/bin/bash"              26 minutes ago       Up 25 minutes                         centos1 
 +2126924504d8   centos         "/bin/bash"              29 minutes ago       Up 29 minutes                         resotest
 </code> </code>
  
Ligne 1052: Ligne 1153:
  
 <code> <code>
-root@debian9:~/wordpress# docker run -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=fenestros --name wordpress --link wordpressdb:mysql -p 10.0.2.60:80:80 -v "$PWD/html":/var/www/html -d wordpress+root@debian11:~/wordpress# docker run -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=fenestros --name wordpress --link wordpressdb:mysql -p 10.0.2.46:80:80 -v "$PWD/html":/var/www/html -d wordpress
 Unable to find image 'wordpress:latest' locally Unable to find image 'wordpress:latest' locally
 latest: Pulling from library/wordpress latest: Pulling from library/wordpress
-2a72cbf407d6: Pull complete  +1f7ce2fa46ab: Already exists  
-273cd543cb15: Pull complete  +48824c101c6a: Pull complete  
-ec5ac8875de7: Pull complete  +249ff3a7bbe6: Pull complete  
-9106e19b56c1: Pull complete  +aa5d47f22b64: Pull complete  
-ee2f70ac7c7d: Pull complete  +851cb5d3b62c: Pull complete  
-7257ad6985e8: Pull complete  +090f07e09d3e: Pull complete  
-18f5c2055da2: Pull complete  +74f97600920f: Pull complete  
-85293a6fdd80: Pull complete  +f48a9f994636: Pull complete  
-9e797eeb0c14: Pull complete  +108b4c091efa: Pull complete  
-f16178842884: Pull complete  +94f753607622: Pull complete  
-13899c06d3f8: Pull complete  +5d0ec11ef45d: Pull complete  
-70c27fe4c3c5: Pull complete  +87757e6fac28: Pull complete  
-d32c8ad2d9d7: Pull complete  +899a04597fc2: Pull complete  
-07fe445494e6: Pull complete  +44506e60b7c1: Pull complete  
-63b8de7b32fe: Pull complete  +305ecc1d68f5: Pull complete  
-e4b721952e22: Pull complete  +a4e6cb47406c: Pull complete  
-d9ede6dd6f74: Pull complete  +8d4e2943ab66: Pull complete  
-0af4f74bfd92: Pull complete  +cab275157cee: Pull complete  
-e4e7c47b969f: Pull complete  +b12b496c1035: Pull complete  
-69aff47f3112: Pull complete  +5bc81c9fd938: Pull complete  
-Digest: sha256:201d004f55669dd2c0884f00fc44145fb0da8cafa465bf22cbaacecaf81138d4+e737031fb816: Pull complete  
 +Digest: sha256:3a2a8b925c86967a43027ec3ba146e1859de1fa0f0f535dd9b40f4d39f8b9caa
 Status: Downloaded newer image for wordpress:latest Status: Downloaded newer image for wordpress:latest
-9eb2f7fbfbd25307ed2f463c7eb3bef40bfa556174e68750bb76b8d032546129+63fec083f4d6bb6a17563d9c6b4aefce2430abea6a2172997038c8f6edabab78
 </code> </code>
  
Ligne 1083: Ligne 1185:
  
 <code> <code>
-root@debian9:~/wordpress# docker ps +root@debian11:~/wordpress# docker ps 
-CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES +CONTAINER ID   IMAGE          COMMAND                  CREATED              STATUS              PORTS                  NAMES 
-9eb2f7fbfbd2        wordpress           "docker-entrypoint.s…"   2 minutes ago       Up About a minute   10.0.2.60:80->80/tcp   wordpress +63fec083f4d6   wordpress      "docker-entrypoint.s…"   About a minute ago   Up About a minute   10.0.2.46:80->80/tcp   wordpress 
-67831dacf002        mariadb:latest      "docker-entrypoint.s…"   minutes ago       Up minutes        3306/tcp               wordpressdb+db3732939266   mysql:latest   "docker-entrypoint.s…"   minutes ago        Up minutes        3306/tcp, 33060/tcp    wordpressdb 
 +57e92a8b25d7   centos         "/bin/bash"              18 minutes ago       Up 18 minutes                              centos3 
 +fc417b22a20d   centos         "/bin/bash"              31 minutes ago       Up 31 minutes                              centos2 
 +cb2875ab1059   centos         "/bin/bash"              31 minutes ago       Up 31 minutes                              centos1 
 +2126924504d8   centos         "/bin/bash"              35 minutes ago       Up 35 minutes                              resotest
 </code> </code>
  
Ligne 1092: Ligne 1198:
  
 <code> <code>
-root@debian9:~/wordpress# lynx --dump http://10.0.2.60 +root@debian11:~/wordpress# lynx --dump http://10.0.2.46 
-   [1]WordPress +   WordPress 
-   Select a default language [English (United States)________]+   Select a default language [English (United States)__________]
  
    Continue    Continue
 +root@debian11:~/wordpress# 
  
-References +root@debian11:~/wordpress# cd - 
- +/root 
-   1. https://wordpress.org/ +root@debian11:~#
- +
-root@debian9:~/wordpress# docker inspect wordpress | grep IPAddress +
-            "SecondaryIPAddresses": null, +
-            "IPAddress": "172.17.0.3", +
-                    "IPAddress": "172.17.0.3", +
-                     +
-root@debian9:~/wordpresslynx --dump http://172.17.0.3 +
-   [1]WordPress +
-   Select a default language [English (United States)________] +
- +
-   Continue +
- +
-References +
- +
-   1. https://wordpress.org/+
 </code> </code>
  
Ligne 1137: Ligne 1229:
  
 <code> <code>
-docker run -d --name=redis redis +root@debian11:~# docker run -d --name=redis redis 
-docker run -d --name=db -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres postgres:9.4  +Unable to find image 'redis:latest' locally 
-docker run -d --name=vote -p 5000:80 --link redis:redis dockersamples/examplevotingapp_vote +latest: Pulling from library/redis 
-docker run -d --name=result -p 5001:80 --link db:db dockersamples/examplevotingapp_result +1f7ce2fa46ab: Already exists  
-docker run -d --name=worker --link db:db --link redis:redis dockersamples/examplevotingapp_worker+4827e9d1e197: Pull complete  
 +5845062cfda9: Pull complete  
 +44d659adcf8b: Pull complete  
 +b6962d83313d: Pull complete  
 +5d29cf86ecab: Pull complete  
 +4f4fb700ef54: Pull complete  
 +3a2d9f90268c: Pull complete  
 +Digest: sha256:396b0f027ba2f33bf385771a621b58c1fd834fd2c522c35c98fd24fc17863c2f 
 +Status: Downloaded newer image for redis:latest 
 +227554e3e4c198272cbf21dd468e7cf78d4a75ad5ed000a9df364aa98726bc86 
 + 
 +root@debian11:~# docker run -d --name=db -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres postgres:9.4  
 +Unable to find image 'postgres:9.4' locally 
 +9.4: Pulling from library/postgres 
 +619014d83c02: Pull complete  
 +7ec0fe6664f6: Pull complete  
 +9ca7ba8f7764: Pull complete  
 +9e1155d037e2: Pull complete  
 +febcfb7f8870: Pull complete  
 +8c78c79412b5: Pull complete  
 +5a35744405c5: Pull complete  
 +27717922e067: Pull complete  
 +36f0c5255550: Pull complete  
 +dbf0a396f422: Pull complete  
 +ec4c06ea33e5: Pull complete  
 +e8dd33eba6d1: Pull complete  
 +51c81b3b2c20: Pull complete  
 +2a03dd76f5d7: Pull complete  
 +Digest: sha256:42a7a6a647a602efa9592edd1f56359800d079b93fa52c5d92244c58ac4a2ab9 
 +Status: Downloaded newer image for postgres:9.4 
 +5083545dcbf88ed9d1e605d306fe8dba86df1c130fcc843e7fba30eadd524545 
 + 
 +root@debian11:~# docker run -d --name=vote -p 5000:80 --link redis:redis dockersamples/examplevotingapp_vote 
 +Unable to find image 'dockersamples/examplevotingapp_vote:latest' locally 
 +latest: Pulling from dockersamples/examplevotingapp_vote 
 +a378f10b3218: Pull complete  
 +c11bdfacfd25: Pull complete  
 +64fc9a66a5d8: Pull complete  
 +5146634606ba: Pull complete  
 +479ce1f6823a: Pull complete  
 +070425b38bdc: Pull complete  
 +ce42fc94cbff: Pull complete  
 +6bad37ec452b: Pull complete  
 +edf50a17349a: Pull complete  
 +db9bdfb7847f: Pull complete  
 +Digest: sha256:797919beacc239d80f6c568e170ad4be0a6afd0ff0567e89d45f1dc3350b87f7 
 +Status: Downloaded newer image for dockersamples/examplevotingapp_vote:latest 
 +81e6fcb9f6920c048b3062e3da8e7e48b0475e5de3059ff3e5e63cbf73cb5fe6 
 + 
 +root@debian11:~# docker run -d --name=result -p 5001:80 --link db:db dockersamples/examplevotingapp_result 
 +Unable to find image 'dockersamples/examplevotingapp_result:latest' locally 
 +latest: Pulling from dockersamples/examplevotingapp_result 
 +a378f10b3218: Already exists  
 +bc194d4002b7: Pull complete  
 +231a505b2fbc: Pull complete  
 +71731700a241: Pull complete  
 +9c2ee871f3d2: Pull complete  
 +a5ec303d8450: Pull complete  
 +0548d3f3cdbd: Pull complete  
 +c33ac9356c9f: Pull complete  
 +495a50ede288: Pull complete  
 +66140bd7f458: Pull complete  
 +4d77129208cd: Pull complete  
 +Digest: sha256:0b8fe15d93c08b9b90ad2eba02af526c1bee8bc9fab162a6b93b3186aa0a5faf 
 +Status: Downloaded newer image for dockersamples/examplevotingapp_result:latest 
 +33a264a36bdc63ba7c0a4e3412e437d20357b1142a02e26b6f6ccfb4aaab6cf2 
 + 
 +root@debian11:~# docker run -d --name=worker --link db:db --link redis:redis dockersamples/examplevotingapp_worker 
 +Unable to find image 'dockersamples/examplevotingapp_worker:latest' locally 
 +latest: Pulling from dockersamples/examplevotingapp_worker 
 +e67fdae35593: Pull complete  
 +0ab66724116f: Pull complete  
 +14ccddebb1bc: Pull complete  
 +5e265b51b431: Pull complete  
 +9ac34f7bda15: Pull complete  
 +17081859cc14: Pull complete  
 +Digest: sha256:bfa42cb2a0200cef7d384635225ca670f08c063341fc401bd27bae67ba6afc04 
 +Status: Downloaded newer image for dockersamples/examplevotingapp_worker:latest 
 +cf27f30654d2c527f30c1ed4b80a517ab589dc1579c30af7bd4e53eba746354a 
 + 
 +root@debian11:~# docker ps 
 +CONTAINER ID   IMAGE                                   COMMAND                  CREATED              STATUS              PORTS                                   NAMES 
 +cf27f30654d2   dockersamples/examplevotingapp_worker   "dotnet Worker.dll"      7 seconds ago        Up 3 seconds                                                worker 
 +33a264a36bdc   dockersamples/examplevotingapp_result   "/usr/bin/tini -- no…"   31 seconds ago       Up 26 seconds       0.0.0.0:5001->80/tcp, :::5001->80/tcp   result 
 +81e6fcb9f692   dockersamples/examplevotingapp_vote     "gunicorn app:app -b…"   55 seconds ago       Up 50 seconds       0.0.0.0:5000->80/tcp, :::5000->80/tcp   vote 
 +5083545dcbf8   postgres:9.4                            "docker-entrypoint.s…"   About a minute ago   Up About a minute   5432/tcp                                db 
 +227554e3e4c1   redis                                   "docker-entrypoint.s…"   About a minute ago   Up About a minute   6379/tcp                                redis 
 +63fec083f4d6   wordpress                               "docker-entrypoint.s…"   43 minutes ago       Up 42 minutes       10.0.2.46:80->80/tcp                    wordpress 
 +db3732939266   mysql:latest                            "docker-entrypoint.s…"   48 minutes ago       Up 48 minutes       3306/tcp, 33060/tcp                     wordpressdb 
 +57e92a8b25d7   centos                                  "/bin/bash"              59 minutes ago       Up 59 minutes                                               centos3 
 +fc417b22a20d   centos                                  "/bin/bash"              About an hour ago    Up About an hour                                            centos2 
 +cb2875ab1059   centos                                  "/bin/bash"              About an hour ago    Up About an hour                                            centos1 
 +2126924504d8   centos                                  "/bin/bash"              About an hour ago    Up About an hour                                            resotest
 </code> </code>
  
 Cette solution utilise un réseau de type Bridge. Ce type de réseau est limité aux conteneurs d'un hôte unique exécutant Docker. Les conteneurs ne peuvent communiquer qu'entre eux et ils ne sont pas accessibles depuis l'extérieur. Pour que les conteneurs sur le réseau puissent communiquer ou être accessibles du monde extérieur, il faut configurer le mappage de port. Cette solution utilise un réseau de type Bridge. Ce type de réseau est limité aux conteneurs d'un hôte unique exécutant Docker. Les conteneurs ne peuvent communiquer qu'entre eux et ils ne sont pas accessibles depuis l'extérieur. Pour que les conteneurs sur le réseau puissent communiquer ou être accessibles du monde extérieur, il faut configurer le mappage de port.
- 
  
 =====LAB #3 - Superviser les Conteneurs===== =====LAB #3 - Superviser les Conteneurs=====
Ligne 1154: Ligne 1337:
  
 <code> <code>
-root@debian9:~# docker logs mongo2 +root@debian11:~# docker logs mongo2 
-root@332aa9930f30:/# ip addr+root@5bfbf0306ad7:/# ip a
 bash: ip: command not found bash: ip: command not found
-root@332aa9930f30:/# ip address+root@5bfbf0306ad7:/# ip addr
 bash: ip: command not found bash: ip: command not found
-root@332aa9930f30:/# ifconfig +root@5bfbf0306ad7:/# exit
-bash: ifconfig: command not found +
-root@332aa9930f30:/# ls +
-bin  boot  core  data  dev  docker-entrypoint-initdb.d entrypoint.sh  etc  home  lib  lib64  media  mnt  opt  proc  root  run sbin  selinux  srv  sys  tmp  usr  var +
-root@332aa9930f30:/# which ip +
-root@332aa9930f30:/# which ifconfig +
-root@332aa9930f30:/# docker run -itd --name centos3 --link centos2:alias centos +
-bash: docker: command not found +
-root@332aa9930f30:/# exit+
 exit exit
 </code> </code>
Ligne 1176: Ligne 1351:
  
 <code> <code>
-root@debian9:~# docker top centos3+root@debian11:~# docker top centos3
 UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
-root                31073               31060               0                   10:20               pts/0               00:00:00            /bin/bash+root                818263              818243              0                   15:49               pts/0               00:00:00            /bin/bash
 </code> </code>
  
Ligne 1186: Ligne 1361:
  
 <code> <code>
-root@debian9:~# docker stats centos3 +root@debian11:~# docker stats centos3 
-CONTAINER           CPU %               MEM USAGE / LIMIT   MEM %               NET I/O             BLOCK I/O           PIDS +CONTAINER ID   NAME      CPU %     MEM USAGE / LIMIT   MEM %     NET I/O         BLOCK I/O    PIDS 
-centos3             0.00%               0B 0B             0.00              4.37kB / 952B       61.4kB / 0B         0+57e92a8b25d7   centos3   0.00%     880KiB 15.62GiB   0.01    4.72kB 854B   0B / 4.1kB   1 
 +^C 
 +root@debian11:~# 
 </code> </code>
  
 ----- -----
  
-Copyright © 2022 Hugh Norris.+Copyright © 2024 Hugh Norris.
Menu