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/10/08 08:37] – 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 148: | Ligne 148: | ||
====1.2 - Préparation==== | ====1.2 - Préparation==== | ||
- | Connectez-vous à la VM Debian_9 | + | Vous devez vous connecter |
< | < | ||
- | desktop@serverXX:~$ ssh -l trainee | + | trainee@traineeXX:~$ ssh -l trainee |
</ | </ | ||
Ligne 315: | 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 334: | Ligne 324: | ||
Actuellement, | Actuellement, | ||
- | Créez le réseau Nat **NatNetwork** | + | Connectez-vous à la VM Debian_9_1 |
< | < | ||
- | desktop@serverXX:~$ VBoxManage natnetwork add --netname NatNetwork --network "10.0.2.0/24" --enable | + | trainee@traineeXX:~$ ssh -l trainee |
- | desktop@serverXX: | + | |
- | desktop@serverXX: | + | |
</ | </ | ||
- | Vérifiez | + | En tant que root, modifiez le nom d' |
< | < | ||
- | desktop@serverXX: | + | trainee@debian91:~$ su - |
- | " | + | |
- | </ | + | |
- | + | ||
- | Placez **Debian_9** dans le réseau NAT **NatNetwork** : | + | |
- | + | ||
- | < | + | |
- | 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:~# apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common |
- | root@debian9:~# nmcli connection mod ip_fixe ipv4.dns 8.8.8.8 | + | root@debian91:~# curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - |
- | root@debian9: | + | root@debian91:~# add-apt-repository |
- | </ | + | root@debian91:~# apt-get update |
- | + | root@debian91:~# apt-get install docker-ce | |
- | Fermez le terminal et reconnectez-vous à votre serveur. Vérifiez que seule la VM **Registry** soit allumée : | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX: | + | |
- | " | + | |
- | </ | + | |
- | + | ||
- | Connectez-vous à la VM **Registry** : | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX:~$ ssh -l trainee localhost -p 2022 | + | |
- | trainee@localhost' | + | |
- | </code> | + | |
- | + | ||
- | Vérifiez la prise en compte de la modification de l' | + | |
- | + | ||
- | < | + | |
- | trainee@registry: | + | |
- | 1: lo: < | + | |
- | link/loopback 00: | + | |
- | 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:~$ VBoxManage natnetwork modify | + | |
- | </code> | + | |
- | + | ||
- | Connectez-vous à la VM **Registry** : | + | |
- | + | ||
- | < | + | |
- | desktop@serverXX: | + | |
- | trainee@localhost' | + | |
- | Linux registry 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 | + | |
- | + | ||
- | 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:~$ su - | + | |
- | Mot de passe : fenestros | + | |
- | root@registry:~# | + | |
</ | </ | ||
- | Editez le fichier **/ | + | Editez le fichier **/ |
< | < | ||
- | root@registry:~# vi / | + | root@debian91:~# vi / |
- | root@registry:~# cat /etc/hosts | + | root@debian91:~# 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 520: | 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 542: | Ligne 394: | ||
root@registry:/# | root@registry:/# | ||
domain.crt | domain.crt | ||
- | </ | ||
- | |||
- | Supprimez le conteneur **registry** : | ||
- | |||
- | < | ||
- | root@registry:/# | ||
- | registry | ||
</ | </ | ||
Ligne 561: | Ligne 406: | ||
CONTAINER ID IMAGE | CONTAINER ID IMAGE | ||
943c01b67cf3 | 943c01b67cf3 | ||
- | ea239635e141 | ||
- | 21b0490a93dd | ||
- | b9773e4aa06d | ||
- | bdb4bc0f81de | ||
- | f5b45072b831 | ||
- | 9731a48f126a | ||
- | eacd70596e23 | ||
- | cffb4456e9c4 | ||
</ | </ | ||
- | ===Configurer | + | Envoyez une copie du fichier **/ |
- | + | ||
- | Sortez | + | |
< | < | ||
- | desktop@serverXX:~$ VBoxManage startvm Debian_9 --type headless | + | root@debian91:~# scp / |
- | Waiting for VM " | + | The authenticity of host ' |
- | VM " | + | ECDSA key fingerprint is 79: |
+ | Are you sure you want to continue connecting (yes/no)? yes | ||
+ | Warning: Permanently added '10.0.2.60' (ECDSA) to the list of known hosts. | ||
+ | trainee@10.0.2.60' | ||
+ | domain.crt | ||
</ | </ | ||
- | Connectez-vous à la VM Debian_9 | + | ===Configurer le Client=== |
+ | |||
+ | Sortez de la VM **debian91** et connectez-vous à la VM debian9 | ||
< | < | ||
- | desktop@serverXX:~$ ssh -l trainee | + | trainee@traineeXX:~$ ssh -l trainee |
</ | </ | ||
Ligne 594: | Ligne 435: | ||
root@debian9: | root@debian9: | ||
</ | </ | ||
- | |||
Supprimez le conteneur **registry** : | Supprimez le conteneur **registry** : | ||
Ligne 602: | 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 627: | 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 673: | Ligne 484: | ||
root@debian9: | root@debian9: | ||
REPOSITORY | REPOSITORY | ||
- | testcache | ||
- | < | ||
i2tch/ | i2tch/ | ||
localhost: | localhost: | ||
- | < | ||
- | i2tch/ | ||
- | i2tch/ | ||
- | i2tch/ | ||
- | ubuntu | ||
- | centos | ||
- | nginx | ||
- | debian | ||
- | hello-world | ||
</ | </ | ||
Ligne 694: | 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 716: | 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 726: | 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 763: | Ligne 542: | ||
----- | ----- | ||
- | < | + | |
- | <div align=" | + | Copyright © 2022 Hugh Norris. |
- | Copyright © 2020 Hugh NORRIS | + | |
- | </ | + | |
- | </ | + |