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:docker3:drf04 [2021/11/23 08:47] – removed admin | elearning:workbooks:docker3:drf04 [2024/02/21 13:40] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ~~PDF: | ||
+ | Version : **2024.01** | ||
+ | |||
+ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
+ | |||
+ | ======DOF605 - Docker Compose, Docker Machine et Docker Swarm====== | ||
+ | |||
+ | =====Contenu du Module===== | ||
+ | |||
+ | * **DOF605 - Docker Compose, Docker Machine et Docker Swarm** | ||
+ | * Contenu du Module | ||
+ | * LAB #1 - Docker Compose | ||
+ | * 1.1 - Installation | ||
+ | * 1.2 - Installer Wordpress avec Docker Compose | ||
+ | * 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 | ||
+ | |||
+ | =====LAB #1 - Docker Compose===== | ||
+ | |||
+ | Docker Compose est un utilitaire de compilation d' | ||
+ | |||
+ | Ce fichier, appelé par la commande **docker-compose build** commence avec un mot clef **image** ou **build** selon que l' | ||
+ | |||
+ | Une fois totalement construite, l' | ||
+ | |||
+ | De cette façon il est possible de démarrer l' | ||
+ | |||
+ | ====1.1 - Installation==== | ||
+ | |||
+ | Récupérez docker-compose avec **curl** : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | % Total % Received % Xferd Average Speed | ||
+ | | ||
+ | 0 | ||
+ | 100 24.7M 100 24.7M 0 | ||
+ | </ | ||
+ | |||
+ | Vérifiez la version installée : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Docker Compose version v2.0.1 | ||
+ | </ | ||
+ | |||
+ | Rendez **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | |||
+ | root@debian11: | ||
+ | -rwxr-xr-x 1 root root 25907200 Dec 16 12:15 / | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **docker-compose** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | |||
+ | Usage: | ||
+ | |||
+ | Docker Compose | ||
+ | |||
+ | Options: | ||
+ | --ansi string | ||
+ | | ||
+ | | ||
+ | --compatibility | ||
+ | --env-file string | ||
+ | -f, --file stringArray | ||
+ | --profile stringArray | ||
+ | --project-directory string | ||
+ | | ||
+ | -p, --project-name string | ||
+ | |||
+ | Commands: | ||
+ | build Build or rebuild services | ||
+ | convert | ||
+ | cp Copy files/ | ||
+ | create | ||
+ | down Stop and remove containers, networks | ||
+ | events | ||
+ | exec Execute a command in a running container. | ||
+ | images | ||
+ | kill Force stop service containers. | ||
+ | logs View output from containers | ||
+ | ls List running compose projects | ||
+ | pause pause services | ||
+ | port Print the public port for a port binding. | ||
+ | ps List containers | ||
+ | pull Pull service images | ||
+ | push Push service images | ||
+ | restart | ||
+ | rm Removes stopped service containers | ||
+ | run Run a one-off command on a service. | ||
+ | start Start services | ||
+ | stop Stop services | ||
+ | top | ||
+ | unpause | ||
+ | up Create and start containers | ||
+ | |||
+ | Run ' | ||
+ | </ | ||
+ | |||
+ | ====1.2 - Installer Wordpress avec Docker Compose==== | ||
+ | |||
+ | Créez maintenant le répertoire **wordpress1** dans /root : | ||
+ | |||
+ | < | ||
+ | root@debian9: | ||
+ | </ | ||
+ | |||
+ | Placez-vous dans le répertoire et créer le fichier **docker-compose.yaml** | ||
+ | |||
+ | < | ||
+ | root@debian9: | ||
+ | root@debian9: | ||
+ | root@debian9: | ||
+ | version: " | ||
+ | | ||
+ | services: | ||
+ | db: | ||
+ | image: mysql:5.7 | ||
+ | volumes: | ||
+ | - db_data:/ | ||
+ | restart: always | ||
+ | environment: | ||
+ | MYSQL_ROOT_PASSWORD: | ||
+ | MYSQL_DATABASE: | ||
+ | MYSQL_USER: wordpress | ||
+ | MYSQL_PASSWORD: | ||
+ | | ||
+ | wordpress: | ||
+ | depends_on: | ||
+ | - db | ||
+ | image: wordpress: | ||
+ | ports: | ||
+ | - " | ||
+ | restart: always | ||
+ | environment: | ||
+ | WORDPRESS_DB_HOST: | ||
+ | WORDPRESS_DB_USER: | ||
+ | WORDPRESS_DB_PASSWORD: | ||
+ | WORDPRESS_DB_NAME: | ||
+ | volumes: | ||
+ | db_data: {} | ||
+ | </ | ||
+ | |||
+ | Exécutez la commande docker-compose : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | [+] Running 12/12 | ||
+ | ⠿ db Pulled | ||
+ | ⠿ 20e4dcae4c69 Pull complete | ||
+ | ⠿ 1c56c3d4ce74 Pull complete | ||
+ | ⠿ e9f03a1c24ce Pull complete | ||
+ | ⠿ 68c3898c2015 Pull complete | ||
+ | ⠿ 6b95a940e7b6 Pull complete | ||
+ | ⠿ 90986bb8de6e Pull complete | ||
+ | ⠿ ae71319cb779 Pull complete | ||
+ | ⠿ ffc89e9dfd88 Pull complete | ||
+ | ⠿ 43d05e938198 Pull complete | ||
+ | ⠿ 064b2d298fba Pull complete | ||
+ | ⠿ df9a4d85569b Pull complete | ||
+ | [+] Running 4/4 | ||
+ | ⠿ Network wordpress1_default | ||
+ | ⠿ Volume " | ||
+ | ⠿ Container wordpress1-db-1 | ||
+ | ⠿ Container wordpress1-wordpress-1 | ||
+ | </ | ||
+ | |||
+ | Vérifiez que le Wordpress fonctionne : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | root@debian11: | ||
+ | CONTAINER ID | ||
+ | 9475874569e1 | ||
+ | 5983cdf711ec | ||
+ | cf27f30654d2 | ||
+ | 33a264a36bdc | ||
+ | 81e6fcb9f692 | ||
+ | 5083545dcbf8 | ||
+ | 227554e3e4c1 | ||
+ | 63fec083f4d6 | ||
+ | db3732939266 | ||
+ | 57e92a8b25d7 | ||
+ | fc417b22a20d | ||
+ | cb2875ab1059 | ||
+ | 2126924504d8 | ||
+ | |||
+ | root@debian11: | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | | ||
+ | root@debian11: | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 50%> | ||
+ | **Important** - La commande **docker-compose up** est une abréviation des commandes **docker-compose build && docker-compose run**. L' | ||
+ | </ | ||
+ | |||
+ | =====LAB #2 - Docker Machine===== | ||
+ | |||
+ | ====2.1 - 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/ | ||
+ | |||
+ | Pour installer docker-machine sur votre VM **debian11**, | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | |||
+ | root@debian11: | ||
+ | % Total % Received % Xferd Average Speed | ||
+ | | ||
+ | 0 | ||
+ | 100 32.6M 100 32.6M 0 | ||
+ | </ | ||
+ | |||
+ | ====2.2 - 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:// | ||
+ | |||
+ | Commencez par installer Oracle VirtualBox: | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Reading package lists... Done | ||
+ | Building dependency tree... Done | ||
+ | Reading state information... Done | ||
+ | The following packages were automatically installed and are no longer required: | ||
+ | libopengl0 linux-headers-5.10.0-15-amd64 linux-headers-5.10.0-15-common | ||
+ | Use 'apt autoremove' | ||
+ | Recommended packages: | ||
+ | linux-image | ||
+ | The following packages will be upgraded: | ||
+ | virtualbox-6.1 | ||
+ | 1 upgraded, 0 newly installed, 0 to remove and 16 not upgraded. | ||
+ | Need to get 95.8 MB of archives. | ||
+ | After this operation, 53.2 kB disk space will be freed. | ||
+ | Get:1 http:// | ||
+ | Fetched 95.8 MB in 3s (31.4 MB/s) | ||
+ | apt-listchanges: | ||
+ | Preconfiguring packages ... | ||
+ | (Reading database ... 166797 files and directories currently installed.) | ||
+ | Preparing to unpack .../ | ||
+ | Unpacking virtualbox-6.1 (6.1.48-159471~Debian~bullseye) over (6.1.46-158378~Debian~bullseye) ... | ||
+ | Setting up virtualbox-6.1 (6.1.48-159471~Debian~bullseye) ... | ||
+ | addgroup: The group `vboxusers' | ||
+ | Processing triggers for hicolor-icon-theme (0.17-2) ... | ||
+ | Processing triggers for shared-mime-info (2.0-1) ... | ||
+ | Processing triggers for mailcap (3.69) ... | ||
+ | Processing triggers for desktop-file-utils (0.26-1) ... | ||
+ | </ | ||
+ | |||
+ | Créez le fichier **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | * 10.0.0.0/8 192.168.0.0/ | ||
+ | </ | ||
+ | |||
+ | Créez maintenant la machine virtuelle **manager1** : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | 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 : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Usage: docker-machine [OPTIONS] COMMAND [arg...] | ||
+ | |||
+ | Create and manage machines running Docker. | ||
+ | |||
+ | Version: 0.16.2, build bd45ab13 | ||
+ | |||
+ | Author: | ||
+ | Docker Machine Contributors - < | ||
+ | |||
+ | Options: | ||
+ | --debug, -D | ||
+ | --storage-path, | ||
+ | --tls-ca-cert | ||
+ | --tls-ca-key | ||
+ | --tls-client-cert | ||
+ | --tls-client-key | ||
+ | --github-api-token | ||
+ | --native-ssh | ||
+ | --bugsnag-api-token | ||
+ | --help, -h show help | ||
+ | --version, -v print the version | ||
+ | | ||
+ | Commands: | ||
+ | active | ||
+ | config | ||
+ | create | ||
+ | env | ||
+ | inspect | ||
+ | ip Get the IP address of a machine | ||
+ | kill Kill a machine | ||
+ | ls List machines | ||
+ | provision | ||
+ | regenerate-certs | ||
+ | restart | ||
+ | rm Remove a machine | ||
+ | ssh Log into or run a command on a machine with SSH. | ||
+ | scp Copy files between machines | ||
+ | mount Mount or unmount a directory from a machine with SSHFS. | ||
+ | start Start a machine | ||
+ | status | ||
+ | stop Stop a machine | ||
+ | upgrade | ||
+ | url Get the URL of a machine | ||
+ | version | ||
+ | help Shows a list of commands or help for one command | ||
+ | | ||
+ | Run ' | ||
+ | </ | ||
+ | |||
+ | Les options de la sous-commande **create** de la commande **docker-machine** sont : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Usage: docker-machine create [OPTIONS] [arg...] | ||
+ | |||
+ | Create a machine | ||
+ | |||
+ | Description: | ||
+ | Run ' | ||
+ | |||
+ | Options: | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Créez maintenant 5 travailleurs - **worker1** jusqu' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | 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 | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | ... | ||
+ | root@debian11: | ||
+ | ... | ||
+ | root@debian11: | ||
+ | ... | ||
+ | root@debian11: | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | ====2.3 - Lister les VM Docker==== | ||
+ | |||
+ | Pour lister les VM Docker ainsi que leurs états, il convient d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | NAME | ||
+ | manager1 | ||
+ | worker1 | ||
+ | worker2 | ||
+ | worker3 | ||
+ | worker4 | ||
+ | worker5 | ||
+ | </ | ||
+ | |||
+ | ====2.4 - Obtenir l' | ||
+ | |||
+ | Une autre façon d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | 192.168.99.100 | ||
+ | root@debian11: | ||
+ | 192.168.99.101 | ||
+ | root@debian11: | ||
+ | 192.168.99.102 | ||
+ | root@debian11: | ||
+ | 192.168.99.103 | ||
+ | root@debian11: | ||
+ | 192.168.99.104 | ||
+ | root@debian11: | ||
+ | 192.168.99.105 | ||
+ | </ | ||
+ | |||
+ | ====2.5 - Se connecter à une VM Docker==== | ||
+ | |||
+ | Pour se connecter à une VM Docker, il convient d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | ( '>' | ||
+ | /) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY. | ||
+ | | ||
+ | |||
+ | docker@manager1: | ||
+ | logout | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 50%> | ||
+ | **Important** - Notez que la distribution de la VM est **[[http:// | ||
+ | </ | ||
+ | |||
+ | Installez maintenant le paquet **mlocate** : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | Reading package lists... Done | ||
+ | Building dependency tree... Done | ||
+ | Reading state information... Done | ||
+ | The following packages were automatically installed and are no longer required: | ||
+ | libopengl0 linux-headers-5.10.0-15-amd64 linux-headers-5.10.0-15-common | ||
+ | Use 'apt autoremove' | ||
+ | Suggested packages: | ||
+ | nocache | ||
+ | The following NEW packages will be installed: | ||
+ | mlocate | ||
+ | 0 upgraded, 1 newly installed, 0 to remove and 16 not upgraded. | ||
+ | Need to get 98.3 kB of archives. | ||
+ | After this operation, 517 kB of additional disk space will be used. | ||
+ | Get:1 http:// | ||
+ | Fetched 98.3 kB in 0s (1,985 kB/s) | ||
+ | Selecting previously unselected package mlocate. | ||
+ | (Reading database ... 166797 files and directories currently installed.) | ||
+ | Preparing to unpack .../ | ||
+ | Unpacking mlocate (0.26-5) ... | ||
+ | Setting up mlocate (0.26-5) ... | ||
+ | update-alternatives: | ||
+ | Adding group `mlocate' | ||
+ | Done. | ||
+ | Created symlink / | ||
+ | mlocate.service is a disabled or a static unit, not starting it. | ||
+ | Processing triggers for man-db (2.9.4-2) ... | ||
+ | </ | ||
+ | |||
+ | Ayant été créées par root, les VM Docker ainsi que leurs fichiers associés sont stockés dans le répertoire **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | |||
+ | root@debian11: | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | =====LAB #3 - Docker Swarm===== | ||
+ | |||
+ | ====3.1 - 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. | ||
+ | |||
+ | ====3.2 - Initialiser Docker Swarm==== | ||
+ | |||
+ | Pour initialiser Docker swarm, il convient d' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | ( '>' | ||
+ | /) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY. | ||
+ | | ||
+ | |||
+ | docker@manager1: | ||
+ | Swarm initialized: | ||
+ | |||
+ | To add a worker to this swarm, run the following command: | ||
+ | |||
+ | docker swarm join --token SWMTKN-1-25tbmsyx452cuhpiedymuc8n9llo9jbjcbza93npdo35q1aaff-9teuxcpe09xw7v7xz1tnwpw4g 192.168.99.100: | ||
+ | |||
+ | To add a manager to this swarm, run ' | ||
+ | </ | ||
+ | |||
+ | Notez que les ports suivants doivent être ouverts sur un nœud manager : 22/tcp, 2376/tcp, 2377/tcp, 7946/tcp, 7946/udp et 4789/udp. | ||
+ | |||
+ | ====3.3 - Le Statut Leader==== | ||
+ | |||
+ | Consultez le statut de la VM Docker manager1 : | ||
+ | |||
+ | < | ||
+ | docker@manager1: | ||
+ | ID HOSTNAME | ||
+ | y0war0lijmwhnexrfhfflulsd * | ||
+ | </ | ||
+ | |||
+ | 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-25tbmsyx452cuhpiedymuc8n9llo9jbjcbza93npdo35q1aaff-1teue04djnc4vu2eufzty59ys 192.168.99.100: | ||
+ | </ | ||
+ | |||
+ | ====3.4 - Rejoindre le Swarm==== | ||
+ | |||
+ | Rejoignez les 5 machines travailleurs à swarm en utilisant le token **worker** : | ||
+ | |||
+ | < | ||
+ | docker@manager1: | ||
+ | logout | ||
+ | |||
+ | root@debian11: | ||
+ | ( '>' | ||
+ | /) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY. | ||
+ | | ||
+ | |||
+ | docker@worker1: | ||
+ | This node joined a swarm as a worker. | ||
+ | |||
+ | docker@worker1: | ||
+ | logout | ||
+ | |||
+ | root@debian11: | ||
+ | ( '>' | ||
+ | /) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY. | ||
+ | | ||
+ | |||
+ | docker@worker2: | ||
+ | This node joined a swarm as a worker. | ||
+ | |||
+ | docker@worker2: | ||
+ | logout | ||
+ | |||
+ | root@debian11: | ||
+ | ( '>' | ||
+ | /) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY. | ||
+ | | ||
+ | |||
+ | docker@worker3: | ||
+ | This node joined a swarm as a worker. | ||
+ | |||
+ | docker@worker3: | ||
+ | logout | ||
+ | |||
+ | root@debian11: | ||
+ | ( '>' | ||
+ | /) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY. | ||
+ | | ||
+ | |||
+ | docker@worker4: | ||
+ | This node joined a swarm as a worker. | ||
+ | |||
+ | docker@worker4: | ||
+ | logout | ||
+ | |||
+ | root@debian11: | ||
+ | ( '>' | ||
+ | /) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY. | ||
+ | | ||
+ | |||
+ | docker@worker5: | ||
+ | This node joined a swarm as a worker. | ||
+ | |||
+ | docker@worker5: | ||
+ | logout | ||
+ | |||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Notez que les ports suivants doivent être ouverts sur un nœud worker : 22/tcp, 2376/tcp, 7946/tcp, 7946/udp et 4789/udp. | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | ( '>' | ||
+ | /) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY. | ||
+ | | ||
+ | |||
+ | docker@manager1: | ||
+ | ID HOSTNAME | ||
+ | y0war0lijmwhnexrfhfflulsd * | ||
+ | v5ai62lmhfsdcauccqmjyu6qk | ||
+ | j4mr3d2ji30t7hu0trob5dpgz | ||
+ | pouo7nuvirq0qkuvvrp04a47h | ||
+ | mo0dd5ech6ifdgd8pa6cjz896 | ||
+ | 5am2vd39pybytu1nd3oooabtq | ||
+ | </ | ||
+ | |||
+ | Notez que vous ne pouvez pas utiliser cette commande à partir d'un travailleur : | ||
+ | |||
+ | < | ||
+ | docker@manager1: | ||
+ | logout | ||
+ | |||
+ | root@debian11: | ||
+ | ( '>' | ||
+ | /) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY. | ||
+ | | ||
+ | |||
+ | 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. | ||
+ | |||
+ | docker@worker5: | ||
+ | logout | ||
+ | exit status 1 | ||
+ | |||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | ====3.5 - Consulter les Informations de Swarm==== | ||
+ | |||
+ | Il est possible de visualiser les informations concernant le swarm en utilisant la commande **docker info** : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | ( '>' | ||
+ | /) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY. | ||
+ | | ||
+ | |||
+ | docker@manager1: | ||
+ | Client: | ||
+ | Debug Mode: false | ||
+ | |||
+ | Server: | ||
+ | | ||
+ | Running: 0 | ||
+ | Paused: 0 | ||
+ | Stopped: 0 | ||
+ | | ||
+ | | ||
+ | | ||
+ | Backing Filesystem: extfs | ||
+ | Supports d_type: true | ||
+ | Native Overlay Diff: true | ||
+ | | ||
+ | | ||
+ | | ||
+ | Volume: local | ||
+ | Network: bridge host ipvlan macvlan null overlay | ||
+ | Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog | ||
+ | | ||
+ | NodeID: y0war0lijmwhnexrfhfflulsd | ||
+ | Is Manager: true | ||
+ | ClusterID: w3mq6i01k4siboyqv3w3nbyu7 | ||
+ | Managers: 1 | ||
+ | Nodes: 6 | ||
+ | Default Address Pool: 10.0.0.0/ | ||
+ | SubnetSize: 24 | ||
+ | Data Path Port: 4789 | ||
+ | Orchestration: | ||
+ | Task History Retention Limit: 5 | ||
+ | Raft: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | Dispatcher: | ||
+ | | ||
+ | CA Configuration: | ||
+ | | ||
+ | Force Rotate: 0 | ||
+ | Autolock Managers: false | ||
+ | Root Rotation In Progress: false | ||
+ | Node Address: 192.168.99.100 | ||
+ | Manager Addresses: | ||
+ | | ||
+ | | ||
+ | | ||
+ | Init Binary: docker-init | ||
+ | | ||
+ | runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd | ||
+ | init version: fec3683 | ||
+ | | ||
+ | seccomp | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | CPUs: 1 | ||
+ | Total Memory: 985.4MiB | ||
+ | Name: manager1 | ||
+ | ID: UIL3: | ||
+ | | ||
+ | Debug Mode: false | ||
+ | | ||
+ | | ||
+ | provider=virtualbox | ||
+ | | ||
+ | | ||
+ | 127.0.0.0/8 | ||
+ | Live Restore Enabled: false | ||
+ | | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 50%> | ||
+ | **Important** - Quand le moteur Docker est en mode swarm, les noeuds de gestion implémentent le **[[https:// | ||
+ | </ | ||
+ | |||
+ | ====3.6 - 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: | ||
+ | oree977o1unlk5ndos0y44i2h | ||
+ | overall progress: 5 out of 5 tasks | ||
+ | 1/5: running | ||
+ | 2/5: running | ||
+ | 3/5: running | ||
+ | 4/5: running | ||
+ | 5/5: running | ||
+ | verify: Service converged | ||
+ | </ | ||
+ | |||
+ | Pour consulter l' | ||
+ | |||
+ | < | ||
+ | docker@manager1: | ||
+ | ID NAME MODE REPLICAS | ||
+ | oree977o1unl | ||
+ | </ | ||
+ | |||
+ | Ce service fonctionne dans des conteneurs Docker : | ||
+ | |||
+ | < | ||
+ | docker@manager1: | ||
+ | ID NAME IMAGE | ||
+ | son0vgc73drb | ||
+ | ojqyweuo65jw | ||
+ | mb40onnaxd0u | ||
+ | 4vwsho5x7i36 | ||
+ | sk9hr6j2u47c | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 50%> | ||
+ | **Important** - Notez qu'il n'y a pas de conteneur sur worker1. | ||
+ | </ | ||
+ | |||
+ | Pour constater le lancement du daemon nginx, lancez la commande **docker ps** sur la machine **manager1** : | ||
+ | |||
+ | < | ||
+ | docker@manager1: | ||
+ | CONTAINER ID IMAGE | ||
+ | 244fecd46312 | ||
+ | </ | ||
+ | |||
+ | Par contre la même commande exécutée sur **worker1** donne le résultat suivant : | ||
+ | |||
+ | < | ||
+ | docker@manager1: | ||
+ | logout | ||
+ | |||
+ | root@debian11: | ||
+ | ( '>' | ||
+ | /) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY. | ||
+ | | ||
+ | |||
+ | docker@worker1: | ||
+ | CONTAINER ID IMAGE | ||
+ | docker@worker1: | ||
+ | logout | ||
+ | |||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Connectez-vous sur chaque VM Docker pour constater que le service nginx fonctionne : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | ( '>' | ||
+ | /) TC (\ Core is distributed with ABSOLUTELY NO WARRANTY. | ||
+ | | ||
+ | |||
+ | docker@manager1: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | html { color-scheme: | ||
+ | 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: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | html { color-scheme: | ||
+ | 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: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | html { color-scheme: | ||
+ | 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: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | html { color-scheme: | ||
+ | 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: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | html { color-scheme: | ||
+ | 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: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | html { color-scheme: | ||
+ | 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 50%> | ||
+ | **Important** - Notez que le service est même disponible en consultant l' | ||
+ | </ | ||
+ | |||
+ | ====3.7 - Augmentation et Réduction du Service==== | ||
+ | |||
+ | Actuellement, | ||
+ | |||
+ | < | ||
+ | docker@manager1: | ||
+ | web scaled to 8 | ||
+ | overall progress: 8 out of 8 tasks | ||
+ | 1/8: running | ||
+ | 2/8: running | ||
+ | 3/8: running | ||
+ | 4/8: running | ||
+ | 5/8: running | ||
+ | 6/8: running | ||
+ | 7/8: running | ||
+ | 8/8: running | ||
+ | verify: Service converged | ||
+ | </ | ||
+ | |||
+ | Notez que la commande **docker service ls** confirme le fait qu'il y a 8 replicas : | ||
+ | |||
+ | < | ||
+ | docker@manager1: | ||
+ | ID NAME MODE REPLICAS | ||
+ | oree977o1unl | ||
+ | </ | ||
+ | |||
+ | Des trois replicas supplémentaires, | ||
+ | |||
+ | < | ||
+ | docker@manager1: | ||
+ | ID NAME IMAGE | ||
+ | son0vgc73drb | ||
+ | ojqyweuo65jw | ||
+ | mb40onnaxd0u | ||
+ | 4vwsho5x7i36 | ||
+ | sk9hr6j2u47c | ||
+ | pui4dnkepu27 | ||
+ | yj0kexdcuo5u | ||
+ | 93jtbxqj2dyz | ||
+ | </ | ||
+ | |||
+ | ====3.8 - 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----- | ||
+ | |||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | ====3.9 - 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 | ||
+ | y0war0lijmwhnexrfhfflulsd * | ||
+ | v5ai62lmhfsdcauccqmjyu6qk | ||
+ | j4mr3d2ji30t7hu0trob5dpgz | ||
+ | pouo7nuvirq0qkuvvrp04a47h | ||
+ | mo0dd5ech6ifdgd8pa6cjz896 | ||
+ | 5am2vd39pybytu1nd3oooabtq | ||
+ | </ | ||
+ | |||
+ | et que sur les 6 VM Docker, il y a 8 conteneurs, | ||
+ | |||
+ | < | ||
+ | docker@manager1: | ||
+ | ID NAME IMAGE | ||
+ | son0vgc73drb | ||
+ | ojqyweuo65jw | ||
+ | mb40onnaxd0u | ||
+ | 4vwsho5x7i36 | ||
+ | sk9hr6j2u47c | ||
+ | pui4dnkepu27 | ||
+ | yj0kexdcuo5u | ||
+ | 93jtbxqj2dyz | ||
+ | </ | ||
+ | |||
+ | dont deux se trouvent sur worker1 : | ||
+ | |||
+ | < | ||
+ | docker@manager1: | ||
+ | ID NAME IMAGE | ||
+ | pui4dnkepu27 | ||
+ | 93jtbxqj2dyz | ||
+ | </ | ||
+ | |||
+ | 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 | ||
+ | son0vgc73drb | ||
+ | ojqyweuo65jw | ||
+ | mb40onnaxd0u | ||
+ | 4vwsho5x7i36 | ||
+ | sk9hr6j2u47c | ||
+ | ag41oh489h4t | ||
+ | pui4dnkepu27 | ||
+ | yj0kexdcuo5u | ||
+ | kv7ax6cwzpkf | ||
+ | 93jtbxqj2dyz | ||
+ | </ | ||
+ | |||
+ | ====3.10 - 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 | ||
+ | </ | ||
+ | |||
+ | ====3.11 - Sauvegarder Docker Swarm==== | ||
+ | |||
+ | La configuration de Docker Swarm est contenue dans le répertoire **/ | ||
+ | |||
+ | < | ||
+ | docker@manager1: | ||
+ | | ||
+ | root@manager1: | ||
+ | total 20 | ||
+ | drwxr-xr-x | ||
+ | -rw------- | ||
+ | drwx------ | ||
+ | -rw------- | ||
+ | drwxr-xr-x | ||
+ | </ | ||
+ | |||
+ | Le processus de sauvegarde necéssite qu'il y ait au moins **deux** Managers dans le Swarm. Le procédure de sauvegarde est : | ||
+ | |||
+ | * arrêt du service Docker sur le Manager à sauvegarder, | ||
+ | * sauvegarde du répertoire **/ | ||
+ | * redémarrage du service Docker sur le Manager concerné. | ||
+ | |||
+ | ====3.12 - Restaurer Docker Swarm==== | ||
+ | |||
+ | Le procédure de resturation est : | ||
+ | |||
+ | * arrêt du service Docker sur un nouveau Manager, | ||
+ | * suppression du contenu du répertoire **/ | ||
+ | * restauration du répertoire **/ | ||
+ | * exécution de la commande **docker swarm init --force-new-cluster** sur le nouveau Manager, | ||
+ | * ajout des Managers et Workers à Swarm. | ||
+ | |||
+ | ----- | ||
+ | |||
+ | Copyright © 2024 Hugh Norris. |