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:drf02 [2023/12/10 17:46] – admin | elearning:workbooks:docker3:drf02 [2024/02/21 13:41] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
~~PDF: | ~~PDF: | ||
- | Version : **2022.01** | + | Version : **2024.01** |
Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
Ligne 28: | Ligne 28: | ||
* 3.1 - Créer un Registre local, | * 3.1 - Créer un Registre local, | ||
* 3.2 - Créer un Serveur de Registre Dédié | * 3.2 - Créer un Serveur de Registre Dédié | ||
- | * Configurer le clone comme Registre Dédié | ||
* Configurer le Client | * Configurer le Client | ||
Ligne 1355: | Ligne 1354: | ||
Actuellement, | Actuellement, | ||
- | Connectez-vous à la VM Debian_9_1 | + | Connectez-vous à la VM **CentOS_10.0.2.45_SSH** à partir de votre VM **Debian_10.0.2.46_SSH** |
< | < | ||
- | trainee@traineeXX:~$ ssh -l trainee 10.0.2.61 | + | root@debian11:~# ssh -l trainee 10.0.2.45 |
+ | trainee@10.0.2.45' | ||
+ | Activate the web console with: systemctl enable --now cockpit.socket | ||
+ | |||
+ | Last login: Wed Nov 15 05:24:16 2023 from 10.0.2.1 | ||
+ | [trainee@centos8 ~]$ | ||
</ | </ | ||
- | En tant que root, modifiez le nom d' | + | Devenez |
< | < | ||
- | trainee@debian91:~$ su - | + | [trainee@centos8 |
- | Mot de passe : fenestros | + | Password: fenestros |
- | root@debian91:~# nmcli general hostname myregistry.i2tch.loc | + | [root@centos8 |
- | root@debian91: | + | |
- | myregistry.i2tch.loc | + | |
</ | </ | ||
- | Installez Docker | + | Modifiez le nom d' |
< | < | ||
- | root@debian91:~# apt-get update | + | [root@centos8 |
- | root@debian91: | + | [root@centos8 |
- | root@debian91: | + | myregistry.i2tch.loc |
- | root@debian91:~# add-apt-repository "deb [arch=amd64] https:// | + | |
- | root@debian91: | + | |
- | root@debian91: | + | |
</ | </ | ||
Ligne 1385: | Ligne 1384: | ||
< | < | ||
- | root@debian91:~# vi / | + | [root@centos8 |
- | root@debian91:~# cat / | + | [root@centos8 |
- | 127.0.0.1 localhost | + | 127.0.0.1 |
- | 10.0.2.60 debian9.i2tch.loc debian9 | + | ::1 |
- | 10.0.2.61 myregistry.i2tch.loc | + | 10.0.2.45 myregistry.i2tch.loc |
- | 10.0.2.62 manager.i2tch.loc manager | + | 10.0.2.46 |
- | 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 | + | |
- | ::1 | + | |
- | ff02::1 ip6-allnodes | + | |
- | ff02::2 ip6-allrouters | + | |
</ | </ | ||
Ligne 1403: | Ligne 1395: | ||
< | < | ||
- | root@debian91:~# cd / && | + | [root@centos8 |
- | Generating a 4096 bit RSA private key | + | |
- | ............................................................++ | + | [root@centos8 /]# vi myconfig.cnf |
- | .......................................................................................................................................++ | + | |
+ | [root@centos8 /]# cat myconfig.cnf | ||
+ | [ req ] | ||
+ | distinguished_name = dn | ||
+ | x509_extensions = extensions | ||
+ | prompt = no | ||
+ | |||
+ | [ extensions ] | ||
+ | subjectAltName = DNS: | ||
+ | |||
+ | [ dn ] | ||
+ | 0.DC = loc | ||
+ | 1.DC = i2tch | ||
+ | commonName = i2tch.loc | ||
+ | |||
+ | [root@centos8 ~]# mkdir certs && openssl req -config myconfig.cnf | ||
+ | Generating a RSA private key | ||
+ | ...............................................................................................................................................................................................++++ | ||
+ | ......++++ | ||
writing new private key to ' | writing new private key to ' | ||
----- | ----- | ||
- | You are about to be asked to enter information that will be incorporated | + | |
- | into your certificate request. | + | [root@centos8 |
- | What you are about to enter is what is called a Distinguished Name or a DN. | + | |
- | There are quite a few fields but you can leave some blank | + | |
- | For some fields there will be a default value, | + | |
- | If you enter ' | + | |
- | ----- | + | |
- | Country Name (2 letter code) [AU]:FR | + | |
- | State or Province Name (full name) [Some-State]: | + | |
- | Locality Name (eg, city) []:Toulon | + | |
- | Organization Name (eg, company) [Internet Widgits Pty Ltd]:I2TCH LTD | + | |
- | Organizational Unit Name (eg, section) []: | + | |
- | Common Name (e.g. server FQDN or YOUR name) []: | + | |
- | Email Address []: | + | |
- | root@registry:/# ls certs/ | + | |
domain.crt | domain.crt | ||
</ | </ | ||
- | Déconnectez-vous de la VM Debian_9_1 | + | Déconnectez-vous de la VM **CentOS8_10.0.2.45_SSH** |
< | < | ||
- | root@debian91:~# exit | + | [root@centos8 /]# exit |
- | trainee@debian91:~$ exit | + | logout |
+ | [trainee@centos8 | ||
+ | logout | ||
+ | Connection to 10.0.2.45 closed. | ||
+ | root@debian11: | ||
</ | </ | ||
- | Connectez-vous à la VM Debian_9_1 | + | Re-connectez-vous à la VM **CentOS8_10.0.2.45_SSH** |
< | < | ||
- | trainee@traineeXX:~$ ssh -l trainee 10.0.2.61 | + | root@debian11:~# ssh -l trainee 10.0.2.45 |
+ | trainee@10.0.2.45' | ||
+ | Activate the web console with: systemctl enable --now cockpit.socket | ||
+ | |||
+ | Last login: Fri Dec 15 01:07:37 2023 from 10.0.2.46 | ||
+ | [trainee@centos8 ~]$ | ||
+ | </ | ||
+ | |||
+ | Devenez root : | ||
+ | |||
+ | < | ||
+ | [trainee@myregistry ~]$ su - | ||
+ | Password: fenestros | ||
+ | [root@myregistry ~]# | ||
</ | </ | ||
Ligne 1443: | Ligne 1457: | ||
< | < | ||
- | root@registry:/# docker run -d -p 5000:5000 --name registry -v / | + | [root@myregistry ~]# docker run -d -p 5000:5000 --name registry -v / |
- | 943c01b67cf3f461270a55ac3d9df6622cc9d74e5f272e17153183ff29ee5932 | + | Unable to find image ' |
+ | latest: Pulling from library/ | ||
+ | c926b61bad3b: | ||
+ | 5501dced60f8: | ||
+ | e875fe5e6b9c: | ||
+ | 21f4bf2f86f9: | ||
+ | 98513cca25bb: | ||
+ | Digest: sha256: | ||
+ | Status: Downloaded newer image for registry: | ||
+ | bf0d4fe9fcb121f9c2d9e85b8f2bb54b01397602ef0dcefdfc71327acf832fec | ||
- | root@registry:/# docker ps -a | + | [root@myregistry ~]# docker ps -a |
- | CONTAINER ID IMAGE | + | CONTAINER ID |
- | 943c01b67cf3 | + | bf0d4fe9fcb1 |
+ | 90267aac9800 | ||
</ | </ | ||
- | Envoyez une copie du fichier **/ | + | Envoyez une copie du fichier **/ |
< | < | ||
- | root@registry:~# scp / | + | [root@myregistry |
- | The authenticity of host ' | + | The authenticity of host ' |
- | ECDSA key fingerprint is 79:00: | + | ECDSA key fingerprint is SHA256:JFem/ |
- | Are you sure you want to continue connecting (yes/no)? yes | + | Are you sure you want to continue connecting (yes/no/ |
- | Warning: Permanently added ' | + | Warning: Permanently added ' |
- | trainee@10.0.2.60's password: | + | trainee@10.0.2.46's password: |
- | domain.crt | + | domain.crt |
</ | </ | ||
===Configurer le Client=== | ===Configurer le Client=== | ||
- | Sortez de la VM **debian91** et connectez-vous à la VM debian9 | + | Sortez de la VM **CentOS8_10.0.2.45_SSH** : |
< | < | ||
- | trainee@traineeXX:~$ ssh -l trainee | + | [root@myregistry ~]# exit |
- | </ | + | logout |
- | + | [trainee@myregistry | |
- | Passez en tant que **root** : | + | logout |
- | + | Connection to 10.0.2.45 closed. | |
- | < | + | root@debian11:~# |
- | trainee@debian9: | + | |
- | Mot de passe : fenestros | + | |
- | root@debian9:~# | + | |
</ | </ | ||
Ligne 1482: | Ligne 1503: | ||
< | < | ||
- | root@debian9:~# docker rm -f registry | + | root@debian11:~# docker rm -f registry |
registry | registry | ||
- | |||
- | root@debian9: | ||
- | CONTAINER ID IMAGE | ||
- | 21b0490a93dd | ||
</ | </ | ||
Ligne 1493: | Ligne 1510: | ||
< | < | ||
- | root@debian9:~# docker rmi registry:2.0 | + | root@debian11:~# docker rmi registry:latest |
- | Untagged: registry:2.0 | + | Untagged: registry:latest |
- | Untagged: registry@sha256: | + | Untagged: registry@sha256: |
- | Deleted: sha256:3bccd459597f38e78ce95a408e506099644ca713d79157d2f3e3a7975f1c9146 | + | Deleted: sha256:909c3ff012b7f9fc4b802b73f250ad45e4ffa385299b71fdd6813f70a6711792 |
- | Deleted: sha256:e486d081a2821af119adbc458214cacf510ebb519cdf31e04ac3d4c6ac521c31 | + | Deleted: sha256:577c3b283118ca6108a6a8c8a0a00eff666dec82c482dd239dfed49f31553df6 |
- | Deleted: sha256:d206757aba612d90965729f186dfb70aa5e63b53dafd7e7b20a76005acddfe24 | + | Deleted: sha256:2ba6acf6ed95c86cfb2c830693135513bc019a0c0cf8f2c58990bc215995699f |
- | Deleted: sha256:1b953394add763fbaa50446b03d636f453fa75b2d12676ceb4b71681b4da6e7d | + | Deleted: sha256:65920463e77382a5cbe8da3e814c4449fc665487c8a9fa4ac27179e809f5ba2e |
- | Deleted: sha256:e8a2cacb793cb843e35bbf64e9c73d685d83ecc8192fbdbc098b0e5fbcced848 | + | Deleted: sha256:54501ccbeaec2665849d200fc4a61ab7254ff0f3bd31ab673879fe321fa2ad7f |
- | Deleted: sha256:19eec9bf8dcc3cb15b93cdcff717057444c540ee641cf20b7ef647d19b9d1df4 | + | Deleted: sha256:9fe9a137fd002363ac64f5af66146702432b638a83ee0c5b620c40a9e433e813 |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | Deleted: sha256: | + | |
- | + | ||
- | root@debian9: | + | |
- | REPOSITORY | + | |
- | i2tch/ | + | |
- | localhost: | + | |
</ | </ | ||
Ligne 1529: | Ligne 1524: | ||
< | < | ||
- | root@debian9:~# docker tag i2tch/ | + | root@debian11:~# docker tag i2tch/ |
- | root@debian9:~# docker images | + | |
- | REPOSITORY | + | root@debian11:~# docker images |
- | i2tch/ | + | REPOSITORY |
- | localhost: | + | testcache |
- | myregistry: | + | < |
+ | i2tch/ | ||
+ | localhost: | ||
+ | myregistry.i2tch.loc: | ||
+ | i2tch/ | ||
+ | i2tch/ | ||
+ | ittraining/ | ||
+ | ubuntu | ||
+ | nginx latest | ||
+ | hello-world | ||
+ | centos | ||
</ | </ | ||
- | Editez le fichier **/ | + | Editez le fichier **/ |
< | < | ||
- | root@debian9:~# vi / | + | root@debian11:~# vi /etc/hosts |
- | root@debian9:~# cat / | + | |
- | 127.0.0.1 localhost | + | root@debian11:~# cat / |
- | 10.0.2.60 debian9.i2tch.loc debian9 | + | 127.0.0.1 |
- | 10.0.2.61 myregistry.i2tch.loc | + | 10.0.2.46 |
- | 10.0.2.62 manager.i2tch.loc manager | + | 10.0.2.45 myregistry.i2tch.loc |
- | 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 1558: | Ligne 1561: | ||
< | < | ||
- | root@debian9:~# mkdir -p / | + | root@debian11:~# mkdir -p / |
- | root@debian9:~# mv /tmp/ca.crt / | + | |
+ | root@debian11:~# mv /tmp/ca.crt / | ||
+ | </ | ||
+ | |||
+ | Créez le fichier **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | |||
+ | root@debian11: | ||
+ | {" | ||
+ | </ | ||
+ | |||
+ | Re-démarrez le service docker : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
</ | </ | ||
Ligne 1565: | Ligne 1584: | ||
< | < | ||
- | root@debian9:~# curl http:// | + | root@debian11:~# curl -k https:// |
- | + | {}root@debian11: | |
</ | </ | ||
Ligne 1572: | Ligne 1591: | ||
< | < | ||
- | root@debian9:~# docker push myregistry: | + | root@debian11:~# docker push myregistry.i2tch.loc: |
- | The push refers to a repository [myregistry: | + | Using default tag: latest |
- | 873a8ac77d4d: Pushed | + | The push refers to repository [myregistry.i2tch.loc: |
- | b362758f4793: Pushed | + | f981bd64e799: Pushed |
- | latest: digest: sha256:30866da81d92d2a1015b869c596ddd6e188f33894c41d8effa2161e5c2862b1f | + | 74ddd0ec08fa: Pushed |
+ | latest: digest: sha256:32f7a11d8a8523bb5b4ac0986844d569ca96df4d1875e7e678a885ee3a3c61c3 | ||
</ | </ | ||
----- | ----- | ||
- | Copyright © 2023 Hugh Norris. | + | Copyright © 2024 Hugh Norris. |