Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| elearning:workbooks:docker1:drf05 [2020/02/15 13:23] – admin | elearning:workbooks:docker1:drf05 [2021/12/29 10:32] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | |||
| ~~PDF: | ~~PDF: | ||
| - | Version : **2020.01** | + | Version : **2022.01** |
| Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
| - | ======DOF202 | + | ======XW330 - Docker |
| - | Cette unité contient trois LABs : | + | =====Contenu du Module===== |
| - | * LAB #2 - Utiliser docker-compose, | + | * **XW330 |
| - | * LAB #3 - Création | + | * Contenu du Module |
| - | * LAB #4 - Utiliser Docker Swarm. | + | * Prérequis |
| + | * Matériel | ||
| + | * Logiciels | ||
| + | * Internet | ||
| + | * Utilisation | ||
| + | * Programme de la Formation | ||
| - | =====Docker Compose===== | + | =====Prérequis===== |
| - | Docker Compose est un utilitaire de compilation d' | + | ==== Matériel==== |
| - | Ce fichier, appelé par la commande **docker-compose build** commence avec un mot clef **image** ou **build** selon que l' | + | * Un poste (MacOS, Linux, Windows(tm) ou Solaris(tm)), |
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | * Un micro (optionnel). | ||
| - | Une fois totalement construite, l' | + | ====Logiciels==== |
| - | De cette façon il est possible de démarrer l' | + | |
| + | | ||
| - | ====Installation==== | + | ====Internet==== |
| - | Récupérez docker-compose avec **curl** : | + | |
| + | * Accès **débloqué** aux domaines suivants : https:// | ||
| + | | ||
| - | < | + | =====Utilisation de l' |
| - | root@debian9: | + | |
| - | % Total % Received % Xferd Average Speed | + | |
| - | | + | |
| - | 100 | + | |
| - | 100 5140k 100 5140k 0 | + | |
| - | root@debian9: | + | Au départ de votre formation, votre formateur vous attribue un ID allant de Trainee01 à Trainee10. |
| - | </ | + | |
| - | Rendez | + | Pour avoir accès à vos machines virtuelles, vous devez d' |
| - | < | + | ^ ID ^ URL ( Notez http: et non https: ) ^ |
| - | root@debian9:~# ls -l /usr/local/bin/docker-compose | + | | Trainee01 | http://compute01.ittraining.network | |
| - | -rw-r--r-- 1 root staff 5263681 Jan 2 16:29 /usr/local/bin/docker-compose | + | | Trainee02 | http://compute02.ittraining.network | |
| - | root@debian9:~# chmod u+x /usr/local/bin/docker-compose | + | | Trainee03 | http://compute03.ittraining.network | |
| - | </code> | + | | Trainee04 | http://compute04.ittraining.network | |
| + | | Trainee05 | http://compute05.ittraining.network | | ||
| + | | Trainee06 | http://compute06.ittraining.network | | ||
| + | | Trainee07 | http:// | ||
| + | | Trainee08 | http:// | ||
| + | | Trainee09 | http:// | ||
| + | | Trainee10 | http://compute10.ittraining.network | | ||
| - | Avant de commencer, installez l' | + | Dans la boîte |
| - | < | + | Cliquez ensuite sur la connexion **Gateway-XX_SSH** ou XX est le numéro dans votre **ID**. |
| - | root@debian9: | + | |
| - | Reading package lists... Done | + | |
| - | Building dependency tree | + | |
| - | Reading state information... Done | + | |
| - | The following NEW packages will be installed: | + | |
| - | tree | + | |
| - | 0 upgraded, 1 newly installed, 0 to remove and 99 not upgraded. | + | |
| - | Need to get 45.9 kB of archives. | + | |
| - | After this operation, 102 kB of additional disk space will be used. | + | |
| - | Get:1 http:// | + | |
| - | Fetched 45.9 kB in 0s (429 kB/s) | + | |
| - | Selecting previously unselected package tree. | + | |
| - | (Reading database ... 100654 files and directories currently installed.) | + | |
| - | Preparing to unpack .../ | + | |
| - | Unpacking tree (1.7.0-3) ... | + | |
| - | Processing triggers for man-db (2.7.0.2-5) ... | + | |
| - | Setting up tree (1.7.0-3) ... | + | |
| - | </ | + | |
| - | ====LAB #2 - Utiliser docker-compose==== | + | Si vous souhaitez avoir accès à votre Gateway directement en utilisant une connexion SSH, utilisez la commande appropriée issue du tableau suivant : |
| - | Dans ce LAB vous allez créer une application simple ayant deux environnements différents : | + | ^ ID ^ Commande ^ |
| + | | Trainee01 | ssh -l trainee compute01.ittraining.network -p 21022 | | ||
| + | | Trainee02 | ssh -l trainee compute02.ittraining.network -p 21122 | | ||
| + | | Trainee03 | ssh -l trainee compute03.ittraining.network -p 21222 | | ||
| + | | Trainee04 | ssh -l trainee compute04.ittraining.network -p 21322 | | ||
| + | | Trainee05 | ssh -l trainee compute05.ittraining.network -p 21422 | | ||
| + | | Trainee06 | ssh -l trainee compute06.ittraining.network -p 21522 | | ||
| + | | Trainee07 | ssh -l trainee compute07.ittraining.network -p 21622 | | ||
| + | | Trainee08 | ssh -l trainee compute08.ittraining.network -p 21722 | | ||
| + | | Trainee09 | ssh -l trainee compute09.ittraining.network -p 21822 | | ||
| + | | Trainee10 | ssh -l trainee compute10.ittraining.network -p 21922 | | ||
| - | * development | + | Utilisez le mot de passe qui vous a été fourni par votre formateur. |
| - | * production | + | |
| - | afin d'utiliser deux configurations différentes selon l' | + | L'adresse IP de la machine virtuelle est : |
| - | Commencez par créer l'arborescence du projet : | + | ^ Machine ^ Nom d'hôte ^ Adresse IP ^ |
| + | | Debian_9 | debian9.i2tch.loc | 10.0.2.60 | | ||
| - | < | + | Les noms d' |
| - | root@debian9:~# mkdir -p MyApp/ | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | </ | + | |
| - | Utilisez l' | + | ^ Utilisateur ^ Mot de Passe ^ |
| + | | trainee | trainee | | ||
| + | | root | fenestros | | ||
| - | < | + | Dernièrement connectez-vous à la machine virtuelle utilisée pour cette formation |
| - | root@debian9:~# cd MyApp | + | |
| - | root@debian9: | + | |
| - | . | + | |
| - | ├── common | + | |
| - | │ └── docker-compose.yml | + | |
| - | ├── development | + | |
| - | │ ├── content | + | |
| - | │ │ ├── Dockerfile | + | |
| - | │ │ └── index.html | + | |
| - | │ └── docker-compose.yml | + | |
| - | └── production | + | |
| - | ├── content | + | |
| - | │ ├── Dockerfile | + | |
| - | │ └── index.html | + | |
| - | └── docker-compose.yml | + | |
| - | 5 directories, | + | $ ssh -l trainee 10.0.2.60 |
| - | </ | + | |
| - | Ce projet comporte | + | =====Programme de la Formation===== |
| - | * **common** | + | ====Jour #1==== |
| - | * La configuration commune aux deux environnements sera placée dans le fichier **MyApp/ | + | |
| - | * **development** | + | |
| - | * La configuration spécifique à l' | + | |
| - | * **production** | + | |
| - | * La configuration spécifique à l' | + | |
| - | Commencez par la création des deux Dockerfile pour **development** et **production**. Afin de garder | + | |
| + | | ||
| + | | ||
| + | | ||
| + | * Logiciels | ||
| + | * Internet | ||
| + | * Utilisation | ||
| + | * Programme de la Formation | ||
| - | < | + | * **DOF101 - La Virtualisation par Isolation** - 3 heures. |
| - | root@debian9: | + | * Présentation de la Virtualisation par Isolation |
| + | * Historique | ||
| + | * Présentation des Namespaces | ||
| + | * Présentation des CGroups | ||
| + | * LAB #1 - Travailler avec les CGroups | ||
| + | * 1.1 - Limitation de la Mémoire | ||
| + | * 1.2 - Le Paquet cgroup-tools | ||
| + | * La commande cgcreate | ||
| + | * La Commande cgexec | ||
| + | * La Commande cgdelete | ||
| + | * Le Fichier | ||
| + | * Présentation de Linux Containers | ||
| + | * LAB #2 - Travailler avec LXC | ||
| + | * 2.1 - Installation | ||
| + | * 2.2 - Création d'un Conteneur Simple | ||
| + | * 2.3 - Démarrage d'un Conteneur Simple | ||
| + | * 2.4 - S' | ||
| + | * 2.5 - Commandes LXC de Base | ||
| + | * La Commande lxc-console | ||
| + | * La Commande lxc-stop | ||
| + | * La Commande lxc-execute | ||
| + | * La Commande lxc-info | ||
| + | * La Commande lxc-freeze | ||
| + | * La Commande lxc-unfreeze | ||
| + | * Autres commandes | ||
| + | * 2.6 - Création d'un Conteneur Non-Privilégié | ||
| + | * User Namespaces | ||
| + | * Création d'un Utilisateur Dédié | ||
| + | * Création du Mappage | ||
| + | * Création du Conteneur | ||
| + | * Contrôle du Mappage | ||
| + | * 2.7 - Création d'un Conteneur Éphémère | ||
| + | * La Commande lxc-copy | ||
| + | * 2.8 - Sauvegarde des Conteneurs | ||
| + | * La Commande lxc-snapshot | ||
| - | root@debian9: | + | * **DOF102 - Démarrer avec Docker** - 3 heures. |
| - | FROM tianon/true | + | * Présentation de Docker |
| + | * LAB #1 - Travailler avec Docker | ||
| + | * 1.1 - Installer docker | ||
| + | * 1.2 - Démarrer un Conteneur | ||
| + | * 1.3 - Consulter la Liste des Conteneurs et Images | ||
| + | * 1.4 - Rechercher une Image dans un Dépôt | ||
| + | * 1.5 - Supprimer un Conteneur d'une Image | ||
| + | * 1.6 - Créer une Image à partir d'un Conteneur Modifié | ||
| + | * 1.7 - Supprimer une Image | ||
| + | * 1.8 - Créer un Conteneur avec un Nom Spécifique | ||
| + | * 1.9 - Exécuter une Commande dans un Conteneur | ||
| + | * 1.10 - Injecter des Variables d' | ||
| + | * 1.11 - Modifier le Nom d' | ||
| + | * 1.12 - Mapper des Ports d'un Conteneur | ||
| + | * 1.13 - Démarrer un Conteneur en mode Détaché | ||
| + | * 1.14 - Accéder aux Services d'un Conteneur de l' | ||
| + | * 1.15 - Arrêter et Démarrer un Conteneur | ||
| + | * 1.16 - Utiliser des Signaux avec un Conteneur | ||
| + | * 1.17 - Forcer la Suppression d'un Conteneur en cours d' | ||
| + | * 1.18 - Utilisation Simple d'un Volume | ||
| + | * 1.19 - Télécharger une image sans créer un conteneur | ||
| + | * 1.20 - S' | ||
| + | * 1.21 - Installer un logiciel dans le conteneur | ||
| + | * 1.22 - Utilisation de la commande docker commit | ||
| + | * 1.23 - Se connecter au serveur du conteneur de l' | ||
| - | VOLUME ["/ | + | ====Jour #2==== |
| - | ADD index.html / | + | |
| - | root@debian9: | + | * **DOF103 - Gérer les Images Docker** - 2 heures. |
| - | </ | + | * Contenu du Module |
| + | * LAB #1 - Re-créer une image officielle docker | ||
| + | * 1.1 - Utilisation d' | ||
| + | * 1.2 - FROM | ||
| + | * 1.3 - RUN | ||
| + | * 1.4 - ENV | ||
| + | * 1.5 - VOLUME | ||
| + | * 1.6 - COPY | ||
| + | * 1.7 - ENTRYPOINT | ||
| + | * 1.8 - EXPOSE | ||
| + | * 1.9 - CMD | ||
| + | * 1.10 - Autres Commandes | ||
| + | * LAB #2 - Créer un Dockerfile | ||
| + | * 2.1 - Création et test du script | ||
| + | * 2.2 - Bonnes Pratiques liées au Cache | ||
| - | Créez maintenant le fichier | + | |
| + | | ||
| + | | ||
| + | * 1.2 - Gestion Manuelle d'un Volume | ||
| + | * LAB #2 - Gestion du Réseau | ||
| + | * 2.1 - L' | ||
| + | * Bridge | ||
| + | * Host | ||
| + | * None | ||
| + | * Liens | ||
| + | * 2.2 - Lancer Wordpress dans un container | ||
| + | * 2.3 - Gestion d'une Architecture de Microservices | ||
| + | * LAB #3 - Superviser les Conteneurs | ||
| + | * 3.1 - Les Journaux | ||
| + | * 3.2 - Les Processus | ||
| + | * 3.3 - L' | ||
| + | * LAB #4 - Gestion des Ressources | ||
| + | * 4.1 - Limiter la Mémoire | ||
| - | < | + | * **DOF202 - Docker Compose, Docker Machine et Docker Swarm** - 2 heures. |
| - | root@debian9: | + | * LAB #1 - Docker Compose |
| + | * 1.1 - Installation | ||
| + | * 1.2 - Utiliser | ||
| + | * LAB #2 - Docker Machine | ||
| + | * 2.1 - Présentation | ||
| + | * 2.2 - Création de Machines Virtuelles Docker | ||
| + | * 2.3 - Lister les VM Docker | ||
| + | * 2.4 - Obtenir l' | ||
| + | * 2.5 - Se connecter à une VM Docker | ||
| + | * LAB #3 - Docker Swarm | ||
| + | * 3.1 - Présentation | ||
| + | * 3.2 - Initialiser Docker Swarm | ||
| + | * 3.3 - Le Statut Leader | ||
| + | * 3.4 - Rejoindre le Swarm | ||
| + | * 3.5 - Consulter les Informations de Swarm | ||
| + | * 3.6 - Démarrer un Service | ||
| + | * 3.7 - Augmentation et Réduction du Service | ||
| + | * 3.8 - Consulter le Statut d'un Nœud | ||
| + | * 3.9 - Haute Disponibilité | ||
| + | * 3.10 - Supprimer un Service | ||
| + | * 3.11 - Sauvegarder Docker Swarm | ||
| + | * 3.12 - Restaurer Docker Swarm | ||
| - | root@debian9: | + | * **XW330 |
| - | web: | + | * Support de Cours |
| - | | + | * Rappel du Programme de la Formation |
| - | | + | * Jour #1 |
| - | | + | * Jour #2 |
| - | </ | + | |
| + | * Validation des acquis | ||
| - | Les deux fichiers **MyApp/ | + | ----- |
| - | < | + | Copyright © 2022 Hugh Norris |
| - | root@debian9: | + | |
| - | + | ||
| - | root@debian9: | + | |
| - | web: | + | |
| - | extends: | + | |
| - | file: ../ | + | |
| - | service: web | + | |
| - | volumes_from: | + | |
| - | - content | + | |
| - | + | ||
| - | content: | + | |
| - | build: content | + | |
| - | + | ||
| - | root@debian9: | + | |
| - | </ | + | |
| - | + | ||
| - | Éditez maintenant les deux fichiers index.html : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | + | ||
| - | root@debian9: | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | root@debian9: | + | |
| - | + | ||
| - | root@debian9: | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | Placez-vous dans le sous-répertoire **development** et exécutez la commande **docker-compose up -d** : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | Creating development_content_1... | + | |
| - | Building content... | + | |
| - | Step 1/3 : FROM tianon/ | + | |
| - | | + | |
| - | Step 2/3 : VOLUME / | + | |
| - | | + | |
| - | | + | |
| - | Removing intermediate container 8619de833add | + | |
| - | Step 3/3 : ADD index.html / | + | |
| - | | + | |
| - | Removing intermediate container a9bec35dba66 | + | |
| - | Successfully built f6fabac6703b | + | |
| - | Successfully tagged development_content: | + | |
| - | Creating development_web_1... | + | |
| - | </ | + | |
| - | + | ||
| - | La commande **docker-compose up** est une abréviation des commandes **docker-compose build && docker-compose run**. L' | + | |
| - | + | ||
| - | Les options de la commande **docker-compose** sont : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | Fast, isolated development environments using Docker. | + | |
| - | + | ||
| - | Usage: | + | |
| - | docker-compose [options] [COMMAND] [ARGS...] | + | |
| - | docker-compose -h|--help | + | |
| - | + | ||
| - | Options: | + | |
| - | --verbose | + | |
| - | --version | + | |
| - | -f, --file FILE | + | |
| - | -p, --project-name NAME | + | |
| - | + | ||
| - | Commands: | + | |
| - | build Build or rebuild services | + | |
| - | help Get help on a command | + | |
| - | kill Kill containers | + | |
| - | logs View output from containers | + | |
| - | port Print the public port for a port binding | + | |
| - | ps List containers | + | |
| - | pull Pulls service images | + | |
| - | rm Remove stopped containers | + | |
| - | run Run a one-off command | + | |
| - | scale Set number of containers for a service | + | |
| - | start Start services | + | |
| - | stop Stop services | + | |
| - | restart | + | |
| - | up Create and start containers | + | |
| - | </ | + | |
| - | + | ||
| - | Vérifiez que l' | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | REPOSITORY | + | |
| - | development_content | + | |
| - | ... | + | |
| - | </ | + | |
| - | + | ||
| - | Constatez la présence des deux conteneurs **nginx: | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 6955516dceff | + | |
| - | 9a1876d7a145 | + | |
| - | ... | + | |
| - | </ | + | |
| - | + | ||
| - | Utilisez maintenant lynx pour consultez **http:// | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | This is the development environement | + | |
| - | + | ||
| - | + | ||
| - | root@debian9: | + | |
| - | </ | + | |
| - | + | ||
| - | Arrêtez docker-compose : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | Stopping development_web_1... | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 6955516dceff | + | |
| - | 9a1876d7a145 | + | |
| - | ... | + | |
| - | </ | + | |
| - | + | ||
| - | Placez-vous maintenant dans le sous-répertoire **production** et exécutez de nouveau la commande **docker-compose up -d** : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | Creating production_content_1... | + | |
| - | Building content... | + | |
| - | Step 1/3 : FROM tianon/ | + | |
| - | | + | |
| - | Step 2/3 : VOLUME / | + | |
| - | | + | |
| - | | + | |
| - | Step 3/3 : ADD index.html / | + | |
| - | | + | |
| - | Removing intermediate container 18af8bcb48ce | + | |
| - | Successfully built 61bcd73aff6e | + | |
| - | Successfully tagged production_content: | + | |
| - | Creating production_web_1... | + | |
| - | </ | + | |
| - | + | ||
| - | Notez la création du conteneur **production_content** : | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 8a2c7346a5db | + | |
| - | 5fde5e7cbd47 | + | |
| - | 6955516dceff | + | |
| - | 9a1876d7a145 | + | |
| - | ... | + | |
| - | </ | + | |
| - | + | ||
| - | En étant dans le contexte **production**, | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | Name | + | |
| - | --------------------------------------------------------------------------- | + | |
| - | production_content_1 | + | |
| - | production_web_1 | + | |
| - | </ | + | |
| - | + | ||
| - | De même en utilisant la même commande dans le répertoire **development**, | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | root@debian9: | + | |
| - | Name Command | + | |
| - | ------------------------------------------------------------- | + | |
| - | development_content_1 | + | |
| - | development_web_1 | + | |
| - | </ | + | |
| - | + | ||
| - | Utilisez maintenant lynx pour consultez **http:// | + | |
| - | + | ||
| - | < | + | |
| - | root@debian9: | + | |
| - | This is the production environement | + | |
| - | + | ||
| - | + | ||
| - | root@debian9: | + | |
| - | </ | + | |
| - | + | ||
| - | =====Docker Machine===== | + | |
| - | + | ||
| - | ====Présentation==== | + | |
| - | + | ||
| - | Docker Machine est un outil qui vous permet d' | + | |
| - | + | ||
| - | Le jeu de commandes de docker-machine permet de démarrer, surveiller, arrêter et re-démarrer un hôte géré, de mettre à jour le client/ | + | |
| - | + | ||
| - | ====Préparation==== | + | |
| - | + | ||
| - | ===Docker-CE=== | + | |
| - | + | ||
| - | Installer Docker-CE sur votre machine hôte : | + | |
| - | + | ||
| - | ==Mac== | + | |
| - | + | ||
| - | * Voir le lien **[[https:// | + | |
| - | + | ||
| - | ==Linux== | + | |
| - | + | ||
| - | * Ubuntu - voir le lien **[[https:// | + | |
| - | * Debian - voir le lien **[[https:// | + | |
| - | * CentOS - voir le lien **[[https:// | + | |
| - | * Fedora - voir le lien **[[https:// | + | |
| - | + | ||
| - | ==Windows 7, 8 et 10== | + | |
| - | + | ||
| - | * Téléchargez Docker Toolbox à partir de cette page **[[https:// | + | |
| - | * Fermez toutes les machines virtuelles ainsi que VirtualBox, | + | |
| - | * Installez **DockerToolBox.exe** (décochez VirtualBox dans la liste de produits à installer), | + | |
| - | * Exécutez Docker Toolbox et laissez l' | + | |
| - | * Ouvrez VirtualBox. Vous verrez une machine virtuelle Default, | + | |
| - | * Ouvrez **cmd** et allez directement au LAB #3. | + | |
| - | + | ||
| - | ====Installation==== | + | |
| - | + | ||
| - | Pour installer docker-machine sur votre **machine hôte**, utilisez une des commandes suivantes : | + | |
| - | + | ||
| - | ===Mac=== | + | |
| - | + | ||
| - | < | + | |
| - | curl -L https:// | + | |
| - | </ | + | |
| - | + | ||
| - | ===Linux=== | + | |
| - | + | ||
| - | < | + | |
| - | curl -L https:// | + | |
| - | </ | + | |
| - | + | ||
| - | ===Windows=== | + | |
| - | + | ||
| - | Si vous utilisez **[[https:// | + | |
| - | + | ||
| - | < | + | |
| - | if [[ ! -d " | + | |
| - | </ | + | |
| - | + | ||
| - | Si vous n' | + | |
| - | + | ||
| - | Téléchargez la version adéquate pour l' | + | |
| - | + | ||
| - | ====LAB #3 - Création de Machines Virtuelles Docker===== | + | |
| - | + | ||
| - | La création d'une machine se fait simplement en utilisant la commande **docker-machine** avec la sous-commande **create**. Cette sous-commande prend l' | + | |
| - | + | ||
| - | ^ Fournisseur ^ driver ^ | + | |
| - | | [[https:// | + | |
| - | | [[https:// | + | |
| - | | [[https:// | + | |
| - | | [[https:// | + | |
| - | | [[http:// | + | |
| - | | [[https:// | + | |
| - | | [[https:// | + | |
| - | | [[https:// | + | |
| - | | [[https:// | + | |
| - | | [[https:// | + | |
| - | | [[https:// | + | |
| - | | [[https:// | + | |
| - | | [[https:// | + | |
| - | + | ||
| - | Créez donc la machine virtuelle **manager1** : | + | |
| - | + | ||
| - | < | + | |
| - | hnorris-laptop ~ # docker-machine create --driver virtualbox manager1 | + | |
| - | Creating CA: / | + | |
| - | Creating client certificate: | + | |
| - | Running pre-create checks... | + | |
| - | (manager1) Image cache directory does not exist, creating it at / | + | |
| - | (manager1) No default Boot2Docker ISO found locally, downloading the latest release... | + | |
| - | (manager1) Latest release for github.com/ | + | |
| - | (manager1) Downloading / | + | |
| - | (manager1) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100% | + | |
| - | Creating machine... | + | |
| - | (manager1) Copying / | + | |
| - | (manager1) Creating VirtualBox VM... | + | |
| - | (manager1) Creating SSH key... | + | |
| - | (manager1) Starting the VM... | + | |
| - | (manager1) Check network to re-create if needed... | + | |
| - | (manager1) Found a new host-only adapter: " | + | |
| - | (manager1) Waiting for an IP... | + | |
| - | Waiting for machine to be running, this may take a few minutes... | + | |
| - | Detecting operating system of created instance... | + | |
| - | Waiting for SSH to be available... | + | |
| - | Detecting the provisioner... | + | |
| - | Provisioning with boot2docker... | + | |
| - | Copying certs to the local machine directory... | + | |
| - | Copying certs to the remote machine... | + | |
| - | Setting Docker configuration on the remote daemon... | + | |
| - | Checking connection to Docker... | + | |
| - | Docker is up and running! | + | |
| - | To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env manager1 | + | |
| - | </ | + | |
| - | + | ||
| - | Les options de la commande **docker-machine** sont : | + | |
| - | + | ||
| - | < | + | |
| - | hnorris-laptop ~ # docker-machine --help | + | |
| - | Usage: docker-machine [OPTIONS] COMMAND [arg...] | + | |
| - | + | ||
| - | Create and manage machines running Docker. | + | |
| - | + | ||
| - | Version: 0.12.2, build 9371605 | + | |
| - | + | ||
| - | Author: | + | |
| - | Docker Machine Contributors - < | + | |
| - | + | ||
| - | Options: | + | |
| - | --debug, -D Enable debug mode | + | |
| - | --storage-path, | + | |
| - | --tls-ca-cert CA to verify remotes against [$MACHINE_TLS_CA_CERT] | + | |
| - | --tls-ca-key Private key to generate certificates [$MACHINE_TLS_CA_KEY] | + | |
| - | --tls-client-cert Client cert to use for TLS [$MACHINE_TLS_CLIENT_CERT] | + | |
| - | --tls-client-key Private key used in client TLS auth [$MACHINE_TLS_CLIENT_KEY] | + | |
| - | --github-api-token Token to use for requests to the Github API [$MACHINE_GITHUB_API_TOKEN] | + | |
| - | --native-ssh Use the native (Go-based) SSH implementation. [$MACHINE_NATIVE_SSH] | + | |
| - | --bugsnag-api-token BugSnag API token for crash reporting [$MACHINE_BUGSNAG_API_TOKEN] | + | |
| - | --help, -h show help | + | |
| - | --version, -v print the version | + | |
| - | + | ||
| - | Commands: | + | |
| - | active Print which machine is active | + | |
| - | config Print the connection config for machine | + | |
| - | create Create a machine | + | |
| - | env Display the commands to set up the environment for the Docker client | + | |
| - | inspect Inspect information about a machine | + | |
| - | ip Get the IP address of a machine | + | |
| - | kill Kill a machine | + | |
| - | ls List machines | + | |
| - | provision Re-provision existing machines | + | |
| - | regenerate-certs Regenerate TLS Certificates for a machine | + | |
| - | restart Restart a machine | + | |
| - | rm Remove a machine | + | |
| - | ssh Log into or run a command on a machine with SSH. | + | |
| - | scp Copy files between machines | + | |
| - | start Start a machine | + | |
| - | status Get the status of a machine | + | |
| - | stop Stop a machine | + | |
| - | upgrade Upgrade a machine to the latest version of Docker | + | |
| - | url Get the URL of a machine | + | |
| - | version Show the Docker Machine version or a machine docker version | + | |
| - | help Shows a list of commands or help for one command | + | |
| - | + | ||
| - | Run ' | + | |
| - | </ | + | |
| - | + | ||
| - | Créez maintenant 5 travailleurs - **worker1** jusqu' | + | |
| - | + | ||
| - | < | + | |
| - | hnorris-laptop ~ # docker-machine create --driver virtualbox worker1 | + | |
| - | Running pre-create checks... | + | |
| - | Creating machine... | + | |
| - | (worker1) Copying / | + | |
| - | (worker1) Creating VirtualBox VM... | + | |
| - | (worker1) Creating SSH key... | + | |
| - | (worker1) Starting the VM... | + | |
| - | (worker1) Check network to re-create if needed... | + | |
| - | (worker1) Waiting for an IP... | + | |
| - | Waiting for machine to be running, this may take a few minutes... | + | |
| - | Detecting operating system of created instance... | + | |
| - | Waiting for SSH to be available... | + | |
| - | Detecting the provisioner... | + | |
| - | Provisioning with boot2docker... | + | |
| - | Copying certs to the local machine directory... | + | |
| - | Copying certs to the remote machine... | + | |
| - | Setting Docker configuration on the remote daemon... | + | |
| - | Checking connection to Docker... | + | |
| - | Docker is up and running! | + | |
| - | To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env worker1 | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | hnorris-laptop ~ # docker-machine create --driver virtualbox worker2 | + | |
| - | ... | + | |
| - | hnorris-laptop ~ # docker-machine create --driver virtualbox worker3 | + | |
| - | ... | + | |
| - | hnorris-laptop ~ # docker-machine create --driver virtualbox worker4 | + | |
| - | ... | + | |
| - | hnorris-laptop ~ # docker-machine create --driver virtualbox worker5 | + | |
| - | ... | + | |
| - | </ | + | |
| - | + | ||
| - | Les options de la sous-commande **create** de la commande **docker-machine** sont : | + | |
| - | + | ||
| - | < | + | |
| - | hnorris-laptop ~ # docker-machine create --help | + | |
| - | Usage: docker-machine create [OPTIONS] [arg...] | + | |
| - | + | ||
| - | Create a machine | + | |
| - | + | ||
| - | Description: | + | |
| - | Run ' | + | |
| - | + | ||
| - | Options: | + | |
| - | + | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | </ | + | |
| - | + | ||
| - | ====Lister les VM Docker==== | + | |
| - | + | ||
| - | Pour lister les VM Docker ainsi que leurs états, il convient d' | + | |
| - | + | ||
| - | < | + | |
| - | hnorris-laptop ~ # docker-machine ls | + | |
| - | NAME | + | |
| - | manager1 | + | |
| - | worker1 | + | |
| - | worker2 | + | |
| - | worker3 | + | |
| - | worker4 | + | |
| - | worker5 | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important> | + | |
| - | **Important** - Si vous avez Windows 7 ou 8 et vous utilisez Docker Toolbox, les adresses IP des machines seront décalées de 1. Par exemple pour manager1, l' | + | |
| - | </ | + | |
| - | + | ||
| - | ====Obtenir l' | + | |
| - | + | ||
| - | Une autre façon d' | + | |
| - | + | ||
| - | < | + | |
| - | hnorris-laptop ~ # docker-machine ip manager1 | + | |
| - | 192.168.99.100 | + | |
| - | hnorris-laptop ~ # docker-machine ip worker1 | + | |
| - | 192.168.99.101 | + | |
| - | hnorris-laptop ~ # docker-machine ip worker2 | + | |
| - | 192.168.99.102 | + | |
| - | hnorris-laptop ~ # docker-machine ip worker3 | + | |
| - | 192.168.99.103 | + | |
| - | hnorris-laptop ~ # docker-machine ip worker4 | + | |
| - | 192.168.99.104 | + | |
| - | hnorris-laptop ~ # docker-machine ip worker5 | + | |
| - | 192.168.99.105 | + | |
| - | </ | + | |
| - | + | ||
| - | ====Se connecter à une VM Docker==== | + | |
| - | + | ||
| - | Pour se connecter à une VM Docker, il convient d' | + | |
| - | + | ||
| - | < | + | |
| - | hnorris-laptop ~ # docker-machine ssh manager1 | + | |
| - | ## . | + | |
| - | ## ## ## == | + | |
| - | ## ## ## ## ## === | + | |
| - | /""""""""""""""""" | + | |
| - | ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~ | + | |
| - | | + | |
| - | | + | |
| - | \____\_______/ | + | |
| - | | + | |
| - | | |__ | + | |
| - | | '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__| | + | |
| - | | |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < | + | |
| - | |_.__/ \___/ \___/ \__|_____\__, | + | |
| - | Boot2Docker version 17.06.2-ce, build HEAD : ff16afa - Wed Sep 6 00:17:25 UTC 2017 | + | |
| - | Docker version 17.06.2-ce, build cec0b72 | + | |
| - | docker@manager1: | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important> | + | |
| - | **Important** - Notez que la distribution de la VM est **[[http:// | + | |
| - | </ | + | |
| - | + | ||
| - | Ayant été créées par root, les VM Docker ainsi que leurs fichiers associés sont stockés dans le répertoire **/ | + | |
| - | + | ||
| - | < | + | |
| - | hnorris-laptop ~ # locate manager1 | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | / | + | |
| - | </ | + | |
| - | + | ||
| - | =====Docker Swarm===== | + | |
| - | + | ||
| - | ====Présentation==== | + | |
| - | + | ||
| - | Docker Swarm est un utilitaire qui permet de gérer un cluster pour déployer des conteneurs en permettant une imitation du comportement de docker sur une seule machine. | + | |
| - | + | ||
| - | ====Initialiser Docker Swarm==== | + | |
| - | + | ||
| - | Pour initialiser Docker swarm, il convient d' | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1: | + | |
| - | Swarm initialized: | + | |
| - | + | ||
| - | To add a worker to this swarm, run the following command: | + | |
| - | + | ||
| - | docker swarm join --token SWMTKN-1-5bd9w9tapfqmd41f2psqdkoqwfo48fqsznnalk2slc28vlp6uh-004kp8y71m09nd7p8ft7ldku0 192.168.99.100: | + | |
| - | + | ||
| - | To add a manager to this swarm, run ' | + | |
| - | </ | + | |
| - | + | ||
| - | ====LAB #4 - Utiliser Docker Swarm==== | + | |
| - | + | ||
| - | ===Le Statut Leader=== | + | |
| - | + | ||
| - | Consultez le statut de la VM Docker manager1 : | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1: | + | |
| - | ID HOSTNAME | + | |
| - | yuwpmvtfmdxn8i7nllkyzkxkp * | + | |
| - | </ | + | |
| - | + | ||
| - | A un instant t il ne peut y avoir q'un seul **Leader**. Il est possible de créer d' | + | |
| - | + | ||
| - | Pour connaître le token nécessaire pour rejoindre swarm en tant que nœud de gestion, saisissez la commande suivante : | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1: | + | |
| - | To add a manager to this swarm, run the following command: | + | |
| - | + | ||
| - | docker swarm join --token SWMTKN-1-5bd9w9tapfqmd41f2psqdkoqwfo48fqsznnalk2slc28vlp6uh-8rvbxvqewsrv6yyts7z2lq9pt 192.168.99.100: | + | |
| - | </ | + | |
| - | + | ||
| - | ===Rejoindre le Swarm=== | + | |
| - | + | ||
| - | Rejoignez les 5 machines travailleurs à swarm en utilisant le token **worker** : | + | |
| - | + | ||
| - | < | + | |
| - | docker@worker1: | + | |
| - | This node joined a swarm as a worker. | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | docker@worker2: | + | |
| - | This node joined a swarm as a worker. | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | docker@worker3: | + | |
| - | This node joined a swarm as a worker. | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | docker@worker4: | + | |
| - | This node joined a swarm as a worker. | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | docker@worker5: | + | |
| - | This node joined a swarm as a worker. | + | |
| - | </ | + | |
| - | + | ||
| - | L' | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1: | + | |
| - | ID HOSTNAME | + | |
| - | 1f5qtolgtonqmhjk5ppwc8x1b | + | |
| - | kmyjdwp9ojhzje4hlw7ffhuxv | + | |
| - | oyszb44k8yw5btz3c1wq2ot2e | + | |
| - | p6jpyopzzy0zg4znegi63hzjq | + | |
| - | yitkfnk99ecisrny9g3r9kfhk | + | |
| - | yuwpmvtfmdxn8i7nllkyzkxkp * | + | |
| - | </ | + | |
| - | + | ||
| - | Notez que vous ne pouvez pas utiliser cette commande à partir d'un travailleur : | + | |
| - | + | ||
| - | < | + | |
| - | docker@worker5: | + | |
| - | Error response from daemon: This node is not a swarm manager. Worker nodes can't be used to view or modify cluster state. Please run this command on a manager node or promote the current node to a manager. | + | |
| - | </ | + | |
| - | + | ||
| - | ===Consulter les Informations de Swarm=== | + | |
| - | + | ||
| - | Il est possible de visualiser les informations concernant le swarm en utilisant la commande **docker info** : | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1: | + | |
| - | ... | + | |
| - | Swarm: active | + | |
| - | | + | |
| - | Is Manager: true | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | Task History Retention Limit: 5 | + | |
| - | | + | |
| - | Snapshot Interval: 10000 | + | |
| - | Number of Old Snapshots to Retain: 0 | + | |
| - | Heartbeat Tick: 1 | + | |
| - | Election Tick: 3 | + | |
| - | | + | |
| - | Heartbeat Period: 5 seconds | + | |
| - | CA Configuration: | + | |
| - | Expiry Duration: 3 months | + | |
| - | Force Rotate: 0 | + | |
| - | Root Rotation In Progress: false | + | |
| - | Node Address: 192.168.99.100 | + | |
| - | | + | |
| - | 192.168.99.100: | + | |
| - | ... | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important> | + | |
| - | **Important** - Quand le moteur Docker est en mode swarm, les noeuds de gestion implémentent le **[[https:// | + | |
| - | </ | + | |
| - | + | ||
| - | ===Démarrer un Service=== | + | |
| - | + | ||
| - | Dans cet exemple, nous allons démarrer le service **nginx** avec les propriétés suivantes : | + | |
| - | + | ||
| - | * Mappage du port nginx sur le port 80 de la machine hôte, | + | |
| - | * 5 instances du service, | + | |
| - | * Un nom unique de **web**. | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1: | + | |
| - | 4xtuwgbvr17lvfzoumh1y4mq4 | + | |
| - | Since --detach=false was not specified, tasks will be created in the background. | + | |
| - | In a future release, --detach=false will become the default. | + | |
| - | </ | + | |
| - | + | ||
| - | Pour consulter l' | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1: | + | |
| - | ID NAME MODE REPLICAS | + | |
| - | 4xtuwgbvr17l | + | |
| - | </ | + | |
| - | + | ||
| - | Ce service fonctionne dans des conteneurs Docker : | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1: | + | |
| - | ID NAME IMAGE | + | |
| - | jkm2hapcthht | + | |
| - | q55eqdhr1qf1 | + | |
| - | imqdkw4ei6gs | + | |
| - | k4vjd0g7ijww | + | |
| - | b7xbmy1npgf9 | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important> | + | |
| - | **Important** - Notez qu'il n'y a pas de conteneur sur worker5. | + | |
| - | </ | + | |
| - | + | ||
| - | Pour constater le lancement du daemon nginx, lancez la commande **docker ps** sur la machine **manager1** : | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1: | + | |
| - | CONTAINER ID IMAGE | + | |
| - | 4107cb687eda | + | |
| - | </ | + | |
| - | + | ||
| - | Connectez-vous sur chaque VM Docker pour constater que le service nginx fonctionne : | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | body { | + | |
| - | width: 35em; | + | |
| - | margin: 0 auto; | + | |
| - | font-family: | + | |
| - | } | + | |
| - | </ | + | |
| - | </ | + | |
| - | < | + | |
| - | < | + | |
| - | <p>If you see this page, the nginx web server is successfully installed and | + | |
| - | working. Further configuration is required.</ | + | |
| - | + | ||
| - | < | + | |
| - | <a href=" | + | |
| - | Commercial support is available at | + | |
| - | <a href=" | + | |
| - | + | ||
| - | < | + | |
| - | </ | + | |
| - | </ | + | |
| - | docker@manager1:/ | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | body { | + | |
| - | width: 35em; | + | |
| - | margin: 0 auto; | + | |
| - | font-family: | + | |
| - | } | + | |
| - | </ | + | |
| - | </ | + | |
| - | < | + | |
| - | < | + | |
| - | <p>If you see this page, the nginx web server is successfully installed and | + | |
| - | working. Further configuration is required.</ | + | |
| - | + | ||
| - | < | + | |
| - | <a href=" | + | |
| - | Commercial support is available at | + | |
| - | <a href=" | + | |
| - | + | ||
| - | < | + | |
| - | </ | + | |
| - | </ | + | |
| - | docker@manager1:/ | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | body { | + | |
| - | width: 35em; | + | |
| - | margin: 0 auto; | + | |
| - | font-family: | + | |
| - | } | + | |
| - | </ | + | |
| - | </ | + | |
| - | < | + | |
| - | < | + | |
| - | <p>If you see this page, the nginx web server is successfully installed and | + | |
| - | working. Further configuration is required.</ | + | |
| - | + | ||
| - | < | + | |
| - | <a href=" | + | |
| - | Commercial support is available at | + | |
| - | <a href=" | + | |
| - | + | ||
| - | < | + | |
| - | </ | + | |
| - | </ | + | |
| - | docker@manager1:/ | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | body { | + | |
| - | width: 35em; | + | |
| - | margin: 0 auto; | + | |
| - | font-family: | + | |
| - | } | + | |
| - | </ | + | |
| - | </ | + | |
| - | < | + | |
| - | < | + | |
| - | <p>If you see this page, the nginx web server is successfully installed and | + | |
| - | working. Further configuration is required.</ | + | |
| - | + | ||
| - | < | + | |
| - | <a href=" | + | |
| - | Commercial support is available at | + | |
| - | <a href=" | + | |
| - | + | ||
| - | < | + | |
| - | </ | + | |
| - | </ | + | |
| - | docker@manager1:/ | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | body { | + | |
| - | width: 35em; | + | |
| - | margin: 0 auto; | + | |
| - | font-family: | + | |
| - | } | + | |
| - | </ | + | |
| - | </ | + | |
| - | < | + | |
| - | < | + | |
| - | <p>If you see this page, the nginx web server is successfully installed and | + | |
| - | working. Further configuration is required.</ | + | |
| - | + | ||
| - | < | + | |
| - | <a href=" | + | |
| - | Commercial support is available at | + | |
| - | <a href=" | + | |
| - | + | ||
| - | < | + | |
| - | </ | + | |
| - | </ | + | |
| - | docker@manager1:/ | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | body { | + | |
| - | width: 35em; | + | |
| - | margin: 0 auto; | + | |
| - | font-family: | + | |
| - | } | + | |
| - | </ | + | |
| - | </ | + | |
| - | < | + | |
| - | < | + | |
| - | <p>If you see this page, the nginx web server is successfully installed and | + | |
| - | working. Further configuration is required.</ | + | |
| - | + | ||
| - | < | + | |
| - | <a href=" | + | |
| - | Commercial support is available at | + | |
| - | <a href=" | + | |
| - | + | ||
| - | < | + | |
| - | </ | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | <WRAP center round important> | + | |
| - | **Important** - Notez que le service est même disponible en consultant l' | + | |
| - | </ | + | |
| - | + | ||
| - | ===Augmentation et Réduction du Service=== | + | |
| - | + | ||
| - | Actuellement, | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | web scaled to 8 | + | |
| - | </ | + | |
| - | + | ||
| - | Notez que la commande **docker service ls** confirme le fait qu'il y a 8 replicas : | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | ID NAME MODE REPLICAS | + | |
| - | 4xtuwgbvr17l | + | |
| - | </ | + | |
| - | + | ||
| - | Des trois replicas supplémentaires, | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | ID NAME IMAGE | + | |
| - | jkm2hapcthht | + | |
| - | q55eqdhr1qf1 | + | |
| - | imqdkw4ei6gs | + | |
| - | k4vjd0g7ijww | + | |
| - | b7xbmy1npgf9 | + | |
| - | kg3bivcg0wln | + | |
| - | ik3u0jfgey64 | + | |
| - | 6bw5ptw7xao8 | + | |
| - | </ | + | |
| - | + | ||
| - | ===Consulter le Statut d'un Noeud=== | + | |
| - | + | ||
| - | Pour se renseigner sur le statut du nœud courant, il convient d' | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | [ | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | ] | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | } | + | |
| - | ] | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | Pour se renseigner sur le statut d'un autre nœud, il convient d' | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | [ | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | ] | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | } | + | |
| - | ] | + | |
| - | </ | + | |
| - | + | ||
| - | L' | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | ID: | + | |
| - | Hostname: | + | |
| - | Joined at: | + | |
| - | Status: | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | Platform: | + | |
| - | | + | |
| - | | + | |
| - | Resources: | + | |
| - | | + | |
| - | | + | |
| - | Plugins: | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | Engine Version: | + | |
| - | Engine Labels: | + | |
| - | - provider=virtualbox | + | |
| - | TLS Info: | + | |
| - | | + | |
| - | -----BEGIN CERTIFICATE----- | + | |
| - | MIIBajCCARCgAwIBAgIUNuU4I89kxId2QXulofRKxJa9XRcwCgYIKoZIzj0EAwIw | + | |
| - | EzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTcwOTA4MTEzOTAwWhcNMzcwOTAzMTEz | + | |
| - | OTAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH | + | |
| - | A0IABEqgLUbyjyNuP35aAzW+aqVB8AkghvpF5hq1KnMveHbl4Ilr+EyDjlYZkbnt | + | |
| - | Gb/ | + | |
| - | Af8EBTADAQH/ | + | |
| - | PQQDAgNIADBFAiB34DOvDtIYjJ+GzbPMGu9Dd/ | + | |
| - | TJBucTomFSDsj5Y/ | + | |
| - | -----END CERTIFICATE----- | + | |
| - | + | ||
| - | | + | |
| - | | + | |
| - | </ | + | |
| - | + | ||
| - | ===Haute Disponibilité=== | + | |
| - | + | ||
| - | Quand un nœud est actif, il est capable de recevoir de nouvelles tâches à partir du manager : | + | |
| - | + | ||
| - | * pendant un scale-up, | + | |
| - | * pendant une une mise à jour progressive, | + | |
| - | * quand un autre nœud reçois une instruction de se mettre en indisponibilité, | + | |
| - | * quand un service se mets en échec sur un autre nœud | + | |
| - | + | ||
| - | Rappelez-vous que la swarm contient 6 VM Docker : | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | ID HOSTNAME | + | |
| - | 1f5qtolgtonqmhjk5ppwc8x1b | + | |
| - | kmyjdwp9ojhzje4hlw7ffhuxv | + | |
| - | oyszb44k8yw5btz3c1wq2ot2e | + | |
| - | p6jpyopzzy0zg4znegi63hzjq | + | |
| - | yitkfnk99ecisrny9g3r9kfhk | + | |
| - | yuwpmvtfmdxn8i7nllkyzkxkp * | + | |
| - | </ | + | |
| - | + | ||
| - | et que sur les 6 VM Docker, il y a 8 conteneurs, | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | ID NAME IMAGE | + | |
| - | jkm2hapcthht | + | |
| - | q55eqdhr1qf1 | + | |
| - | imqdkw4ei6gs | + | |
| - | k4vjd0g7ijww | + | |
| - | b7xbmy1npgf9 | + | |
| - | kg3bivcg0wln | + | |
| - | ik3u0jfgey64 | + | |
| - | 6bw5ptw7xao8 | + | |
| - | </ | + | |
| - | + | ||
| - | dont deux se trouvent sur worker1 : | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | ID NAME IMAGE | + | |
| - | k4vjd0g7ijww | + | |
| - | 6bw5ptw7xao8 | + | |
| - | </ | + | |
| - | + | ||
| - | Mettez worker1 en mode d' | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | worker1 | + | |
| - | </ | + | |
| - | + | ||
| - | Constatez que le service web a été déplacé sur deux autres noeuds, **manager1** et **worker4** : | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | ID NAME IMAGE | + | |
| - | jkm2hapcthht | + | |
| - | q55eqdhr1qf1 | + | |
| - | imqdkw4ei6gs | + | |
| - | 6cv6j4tz0nk5 | + | |
| - | k4vjd0g7ijww | + | |
| - | b7xbmy1npgf9 | + | |
| - | kg3bivcg0wln | + | |
| - | ik3u0jfgey64 | + | |
| - | wht3r8c9wga6 | + | |
| - | 6bw5ptw7xao8 | + | |
| - | </ | + | |
| - | + | ||
| - | ===Supprimer un Service=== | + | |
| - | + | ||
| - | Pour supprimer un service il convient d' | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | web | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | ID NAME MODE REPLICAS | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | docker@manager1:/ | + | |
| - | [] | + | |
| - | Status: Error: no such service: web, Code: 1 | + | |
| - | </ | + | |
| - | + | ||
| - | ----- | + | |
| - | < | + | |
| - | <div align=" | + | |
| - | Copyright © 2020 Hugh NORRIS | + | |
| - | </ | + | |
| - | </ | + | |