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:docker2:drf00 [2020/08/18 10:19] – admin | elearning:workbooks:docker2:drf00 [2022/04/29 07:59] (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~~ | ||
Ligne 147: | Ligne 147: | ||
====1.2 - Préparation==== | ====1.2 - Préparation==== | ||
+ | |||
+ | Vous devez vous connecter à la machine virtuelle debian9 à partir d'un terminal de votre gateway : | ||
+ | |||
+ | < | ||
+ | trainee@traineeXX: | ||
+ | </ | ||
+ | |||
+ | Passez en tant que **root** : | ||
+ | |||
+ | < | ||
+ | trainee@debian9: | ||
+ | Mot de passe : fenestros | ||
+ | root@debian9: | ||
+ | </ | ||
Créez un répertoire nommé myDocker : | Créez un répertoire nommé myDocker : | ||
< | < | ||
- | root@debian9: | + | root@debian9: |
- | root@debian9: | + | root@debian9: |
root@debian9: | root@debian9: | ||
</ | </ | ||
Ligne 260: | Ligne 274: | ||
</ | </ | ||
- | Utilisez maintenant **lynx** à partir d'un terminal de votre machine **hôte** pour vérifier que le registre est actif : | + | Utilisez maintenant **lynx** à partir d'un terminal de votre machine **hôte |
< | < | ||
Ligne 301: | Ligne 315: | ||
root@debian9: | root@debian9: | ||
REPOSITORY | REPOSITORY | ||
- | testcache | ||
- | < | ||
i2tch/ | i2tch/ | ||
localhost: | localhost: | ||
- | i2tch/ | ||
- | i2tch/ | ||
- | i2tch/ | ||
- | ubuntu | ||
- | centos | ||
- | nginx | ||
- | debian | ||
- | hello-world | ||
registry | registry | ||
</ | </ | ||
Ligne 320: | Ligne 324: | ||
Actuellement, | Actuellement, | ||
- | Vérifiez que votre machine virtuelle **Debian_9** est allumée | + | Connectez-vous à la VM Debian_9_1 |
< | < | ||
- | desktop@serverXX:~$ VBoxManage list runningvms | + | trainee@traineeXX:~$ ssh -l trainee 10.0.2.61 |
- | " | + | |
</ | </ | ||
- | Placez **Debian_9** dans le réseau NAT **NatNetwork** | + | En tant que root, modifiez |
< | < | ||
- | desktop@serverXX: | + | trainee@debian91:~$ su - |
- | </ | + | |
- | + | ||
- | Si vous obtenez une erreur lors de l' | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX: | + | |
- | desktop@serverXX: | + | |
- | desktop@serverXX: | + | |
- | </ | + | |
- | + | ||
- | Arrêtez la VM **Debian_9** : | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX: | + | |
- | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | + | |
- | </ | + | |
- | + | ||
- | Créez un clone de la VM **Debian_9** appelé **Registry** : | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX: | + | |
- | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | + | |
- | Machine has been successfully cloned as " | + | |
- | </ | + | |
- | + | ||
- | Vérifiez la présence de votre clône : | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX: | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | </ | + | |
- | + | ||
- | Démarrez la machine virtuelle **Registry** : | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX: | + | |
- | </ | + | |
- | + | ||
- | Configurez votre clone en réseau NAT : | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX: | + | |
- | </ | + | |
- | + | ||
- | Connectez-vous à votre clone : | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX: | + | |
- | trainee@localhost' | + | |
- | </ | + | |
- | + | ||
- | En tant que root, modifiez le nom d' | + | |
- | + | ||
- | < | + | |
- | trainee@debian9:~$ su - | + | |
Mot de passe : fenestros | Mot de passe : fenestros | ||
- | root@debian9:~# nmcli general hostname | + | root@debian91:~# nmcli general hostname |
- | root@debian9:~# hostname | + | root@debian91:~# hostname |
- | registry | + | myregistry.i2tch.loc |
</ | </ | ||
- | Configurez une adresse IP fixe pour la VM **Registry** | + | Installez Docker |
< | < | ||
- | root@debian9:~# nmcli connection add con-name ip_fixe ifname enp0s3 type ethernet ip4 10.0.2.4/24 gw4 10.0.2.2 | + | root@debian91:~# apt-get update |
- | Connexion « ip_fixe » (a84f9227-dd89-4e06-957f-cb707e83fd47) ajoutée avec succès. | + | root@debian91: |
- | root@debian9:~# nmcli connection mod ip_fixe ipv4.dns 8.8.8.8 | + | root@debian91:~# curl -fsSL https:// |
- | root@debian9:~# nmcli connection up ip_fixe | + | root@debian91: |
+ | root@debian91:~# apt-get update | ||
+ | root@debian91: | ||
</ | </ | ||
- | Fermez | + | Editez |
< | < | ||
- | desktop@serverXX: | + | root@debian91:~# vi / |
- | " | + | root@debian91:~# cat /etc/hosts |
- | </ | + | |
- | + | ||
- | Connectez-vous à la VM **Registry** : | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX: | + | |
- | trainee@localhost' | + | |
- | </ | + | |
- | + | ||
- | Vérifiez la prise en compte de la modification de l' | + | |
- | + | ||
- | < | + | |
- | trainee@registry: | + | |
- | 1: lo: < | + | |
- | link/ | + | |
- | inet 127.0.0.1/8 scope host lo | + | |
- | | + | |
- | inet6 ::1/128 scope host | + | |
- | | + | |
- | 2: enp0s3: < | + | |
- | link/ether 08: | + | |
- | inet 10.0.2.4/24 brd 10.0.2.255 scope global enp0s3 | + | |
- | | + | |
- | inet6 fe80:: | + | |
- | | + | |
- | </ | + | |
- | + | ||
- | Sortez de la VM **Registry** : | + | |
- | + | ||
- | < | + | |
- | trainee@registry: | + | |
- | déconnexion | + | |
- | Connection to localhost closed. | + | |
- | </ | + | |
- | + | ||
- | Remettez la VM **Registry** dans le réseau NAT NatNetwork : | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX: | + | |
- | </ | + | |
- | + | ||
- | Configurez la redirection des ports dans le réseau NAT NatNetwork : | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX: | + | |
- | desktop@serverXX: | + | |
- | </ | + | |
- | + | ||
- | Connectez-vous à la VM **Registry** : | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX: | + | |
- | trainee@localhost' | + | |
- | Linux registry 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 | + | |
- | + | ||
- | The programs included with the Debian GNU/Linux system are free software; | + | |
- | the exact distribution terms for each program are described in the | + | |
- | individual files in / | + | |
- | + | ||
- | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | + | |
- | permitted by applicable law. | + | |
- | Last login: Fri Apr 17 15:36:25 2020 from 10.0.2.2 | + | |
- | trainee@registry: | + | |
- | Mot de passe : fenestros | + | |
- | root@registry: | + | |
- | </ | + | |
- | + | ||
- | Editez le fichier **/ | + | |
- | + | ||
- | < | + | |
- | root@registry:~# vi / | + | |
- | root@registry:~# cat /etc/hosts | + | |
127.0.0.1 localhost | 127.0.0.1 localhost | ||
- | 127.0.1.1 debian9.i2tch.loc | + | 10.0.2.60 debian9.i2tch.loc debian9 |
- | 10.0.2.4 myregistry.i2tch.loc | + | 10.0.2.61 myregistry.i2tch.loc |
- | 10.0.2.15 | + | 10.0.2.62 manager.i2tch.loc manager |
+ | 10.0.2.63 worker1.i2tch.loc worker1 | ||
+ | 10.0.2.64 worker2.i2tch.loc worker2 | ||
# The following lines are desirable for IPv6 capable hosts | # The following lines are desirable for IPv6 capable hosts | ||
Ligne 506: | Ligne 372: | ||
< | < | ||
- | root@registry:~# cd / && mkdir certs && openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/ | + | root@debian91:~# cd / && mkdir certs && openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/ |
Generating a 4096 bit RSA private key | Generating a 4096 bit RSA private key | ||
............................................................++ | ............................................................++ | ||
Ligne 528: | Ligne 394: | ||
root@registry:/# | root@registry:/# | ||
domain.crt | domain.crt | ||
- | </ | ||
- | |||
- | Supprimez le conteneur **registry** : | ||
- | |||
- | < | ||
- | root@registry:/# | ||
- | registry | ||
</ | </ | ||
Ligne 547: | Ligne 406: | ||
CONTAINER ID IMAGE | CONTAINER ID IMAGE | ||
943c01b67cf3 | 943c01b67cf3 | ||
- | ea239635e141 | + | </code> |
- | 21b0490a93dd | + | |
- | b9773e4aa06d | + | Envoyez une copie du fichier **/certs/ |
- | bdb4bc0f81de | + | |
- | f5b45072b831 | + | < |
- | 9731a48f126a | + | root@debian91: |
- | eacd70596e23 | + | The authenticity of host '10.0.2.60 (10.0.2.60)' can't be established. |
- | cffb4456e9c4 | + | ECDSA key fingerprint is 79: |
+ | Are you sure you want to continue connecting | ||
+ | Warning: Permanently added '10.0.2.60' | ||
+ | trainee@10.0.2.60's password: trainee | ||
+ | domain.crt | ||
</ | </ | ||
===Configurer le Client=== | ===Configurer le Client=== | ||
+ | |||
+ | Sortez de la VM **debian91** et connectez-vous à la VM debian9 : | ||
+ | |||
+ | < | ||
+ | trainee@traineeXX: | ||
+ | </ | ||
+ | |||
+ | Passez en tant que **root** : | ||
+ | |||
+ | < | ||
+ | trainee@debian9: | ||
+ | Mot de passe : fenestros | ||
+ | root@debian9: | ||
+ | </ | ||
Supprimez le conteneur **registry** : | Supprimez le conteneur **registry** : | ||
Ligne 565: | Ligne 442: | ||
CONTAINER ID IMAGE | CONTAINER ID IMAGE | ||
c4c7cad999cd | c4c7cad999cd | ||
- | ea239635e141 | ||
21b0490a93dd | 21b0490a93dd | ||
- | b9773e4aa06d | + | |
- | bdb4bc0f81de | + | |
- | f5b45072b831 | + | |
- | 9731a48f126a | + | |
- | eacd70596e23 | + | |
- | cffb4456e9c4 | + | |
root@debian9: | root@debian9: | ||
registry | registry | ||
+ | |||
root@debian9: | root@debian9: | ||
CONTAINER ID IMAGE | CONTAINER ID IMAGE | ||
- | ea239635e141 | ||
21b0490a93dd | 21b0490a93dd | ||
- | b9773e4aa06d | ||
- | bdb4bc0f81de | ||
- | f5b45072b831 | ||
- | 9731a48f126a | ||
- | eacd70596e23 | ||
- | cffb4456e9c4 | ||
</ | </ | ||
Ligne 590: | Ligne 455: | ||
< | < | ||
- | root@debian9: | ||
- | REPOSITORY | ||
- | testcache | ||
- | < | ||
- | i2tch/ | ||
- | localhost: | ||
- | < | ||
- | i2tch/ | ||
- | i2tch/ | ||
- | i2tch/ | ||
- | ubuntu | ||
- | centos | ||
- | nginx | ||
- | debian | ||
- | hello-world | ||
- | registry | ||
- | |||
root@debian9: | root@debian9: | ||
Untagged: registry: | Untagged: registry: | ||
Ligne 636: | Ligne 484: | ||
root@debian9: | root@debian9: | ||
REPOSITORY | REPOSITORY | ||
- | testcache | ||
- | < | ||
i2tch/ | i2tch/ | ||
localhost: | localhost: | ||
- | < | ||
- | i2tch/ | ||
- | i2tch/ | ||
- | i2tch/ | ||
- | ubuntu | ||
- | centos | ||
- | nginx | ||
- | debian | ||
- | hello-world | ||
</ | </ | ||
Ligne 657: | Ligne 494: | ||
root@debian9: | root@debian9: | ||
REPOSITORY | REPOSITORY | ||
- | testcache | ||
- | < | ||
i2tch/ | i2tch/ | ||
localhost: | localhost: | ||
myregistry: | myregistry: | ||
- | < | ||
- | i2tch/ | ||
- | i2tch/ | ||
- | i2tch/ | ||
- | ubuntu | ||
- | centos | ||
- | nginx latest | ||
- | debian | ||
- | hello-world | ||
</ | </ | ||
- | Éditez | + | Editez |
< | < | ||
Ligne 679: | Ligne 505: | ||
root@debian9: | root@debian9: | ||
127.0.0.1 localhost | 127.0.0.1 localhost | ||
- | 127.0.1.1 debian9.i2tch.loc | + | 10.0.2.60 debian9.i2tch.loc debian9 |
- | 10.0.2.4 myregistry.i2tch.loc | + | 10.0.2.61 myregistry.i2tch.loc |
- | 10.0.2.15 | + | 10.0.2.62 manager.i2tch.loc manager |
+ | 10.0.2.63 worker1.i2tch.loc worker1 | ||
+ | 10.0.2.64 worker2.i2tch.loc worker2 | ||
# The following lines are desirable for IPv6 capable hosts | # The following lines are desirable for IPv6 capable hosts | ||
Ligne 689: | Ligne 517: | ||
</ | </ | ||
- | De la machine virtuelle **registry** envoyez une copie du fichier **/ | + | Déplacez |
- | + | ||
- | < | + | |
- | root@registry: | + | |
- | The authenticity of host ' | + | |
- | ECDSA key fingerprint is 79: | + | |
- | Are you sure you want to continue connecting (yes/no)? yes | + | |
- | Warning: Permanently added ' | + | |
- | trainee@10.0.2.15' | + | |
- | domain.crt | + | |
- | </ | + | |
- | + | ||
- | Dans la machine virtuelle **Debian_9**, | + | |
< | < | ||
Ligne 726: | Ligne 542: | ||
----- | ----- | ||
- | < | + | |
- | <div align=" | + | Copyright © 2022 Hugh Norris. |
- | Copyright © 2020 Hugh NORRIS | + | |
- | </ | + | |
- | </ | + |