issue211:tutoriel2
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue211:tutoriel2 [2024/11/30 19:02] – créée auntiee | issue211:tutoriel2 [2024/12/04 16:34] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | Canonical has made Linux containers really easy with Snaps. Don’t get me wrong, we still have to configure it, but if you look here, it’s as simple as 1,2,3: https:// | + | **Canonical has made Linux containers really easy with Snaps. Don’t get me wrong, we still have to configure it, but if you look here, it’s as simple as 1,2,3: https:// |
Before you follow me down this rabbit hole, let's install lxd and then I will take you through our configuration. Start by making sure all your Snaps are up-to-date: sudo snap refresh - and let it do its thing, before running: | Before you follow me down this rabbit hole, let's install lxd and then I will take you through our configuration. Start by making sure all your Snaps are up-to-date: sudo snap refresh - and let it do its thing, before running: | ||
Ligne 5: | Ligne 5: | ||
sudo snap install lxd | sudo snap install lxd | ||
- | As you can see from Canonical’s site, there isn’t much to do other than initialise the application. Type: lxd init and let’s navigate the questions together? (We do this only the very first time, so don’t worry too much). We pretty much stick with the defaults. However, you may name your storage pool anything you like; for our tutorial, I’ll just name it fcmpool, or something similar, and we will use dir instead of zfs. We can type out the yes & no, but we can also just press enter to confirm the defaults. I will do both so you can see. It is only IPv6 where I select “none”, and once you are done, you have the option of printing a YAML file for future reference. | + | As you can see from Canonical’s site, there isn’t much to do other than initialise the application. Type: lxd init and let’s navigate the questions together? (We do this only the very first time, so don’t worry too much). We pretty much stick with the defaults. However, you may name your storage pool anything you like; for our tutorial, I’ll just name it fcmpool, or something similar, and we will use dir instead of zfs. We can type out the yes & no, but we can also just press enter to confirm the defaults. I will do both so you can see. It is only IPv6 where I select “none”, and once you are done, you have the option of printing a YAML file for future reference. |
+ | Canonical a rendu les conteneurs Linux vraiment faciles avec Snaps. Ne vous méprenez pas, nous devons toujours le configurer, mais si vous regardez ici, c'est aussi simple que 1,2,3 : https:// | ||
- | You can check if it is operational | + | Avant de me suivre dans ce terrier de lapin, installons lxd, puis je vous guiderai dans notre configuration. Commencez par vous assurer que tous vos Snaps sont à jour : |
+ | |||
+ | sudo snap refresh | ||
+ | |||
+ | et laissez-le faire son travail, avant d' | ||
+ | |||
+ | sudo snap install lxd | ||
+ | |||
+ | Comme vous pouvez le voir sur le site de Canonical, il n'y a pas grand-chose à faire à part initialiser l' | ||
+ | |||
+ | |||
+ | **You can check if it is operational | ||
- ps -aux | grep lxd | - ps -aux | grep lxd | ||
and you should see that shown below right. | and you should see that shown below right. | ||
- | |||
Now that we have LXD running, let’s confirm there are no ‘running’ containers: | Now that we have LXD running, let’s confirm there are no ‘running’ containers: | ||
Ligne 18: | Ligne 29: | ||
lxc list | lxc list | ||
- | We can also now confirm that there are no images on the system: lxc images list | + | We can also now confirm that there are no images on the system:lxc images list |
Great, a blank slate! (Ok not really, we have some repos configured for us); lxc remote list - to see them. | Great, a blank slate! (Ok not really, we have some repos configured for us); lxc remote list - to see them. | ||
Ligne 27: | Ligne 38: | ||
You may see that images are built daily, but even then, these are not “official” images. | You may see that images are built daily, but even then, these are not “official” images. | ||
- | We can even go look on: https:// | + | We can even go look on: https:// |
- | Now, back to the very first page link ^^^^^ right at the top, and you will see the syntax is: lxc launch < | + | Vous pouvez vérifier si c'est opérationnel : |
+ | ps -aux | grep lxd | ||
+ | |||
+ | et vous devriez voir cela affiché ci-dessous à droite. | ||
+ | |||
+ | Maintenant que LXD est en cours d' | ||
+ | |||
+ | lxc list | ||
+ | |||
+ | Nous pouvons également maintenant confirmer qu'il n'y a pas d' | ||
+ | |||
+ | lxc image list | ||
+ | |||
+ | Super, une page blanche ! (Ok pas vraiment, il y a des dépôts configurés pour nous); pour les voir : | ||
+ | |||
+ | lxc remote list | ||
+ | |||
+ | Si vous maintenez la touche CTRL enfoncée et cliquez sur le tout premier lien, il ouvrira ce lien dans un navigateur pour vous (https:// | ||
+ | |||
+ | Vous pouvez voir que des images sont créées quotidiennement, | ||
+ | |||
+ | Nous pouvons même aller voir : https:// | ||
+ | |||
+ | |||
+ | **Now, back to the very first page link ^^^^^ right at the top, and you will see the syntax is: lxc launch < | ||
You just have to remember ‘lxc launch’, but let’s go ahead and do the thing... you know, copy/paste from the website. OR you can try the command they give you once you typed lxc list. I’m not going to type it here, just to make sure you are ‘doing’, | You just have to remember ‘lxc launch’, but let’s go ahead and do the thing... you know, copy/paste from the website. OR you can try the command they give you once you typed lxc list. I’m not going to type it here, just to make sure you are ‘doing’, | ||
Ligne 41: | Ligne 76: | ||
So are we all on the same page? Good! I installed Ubuntu and Alpine, so you can see the difference in size: 241MB vs 3MB, so those of you on metered or slow connections, | So are we all on the same page? Good! I installed Ubuntu and Alpine, so you can see the difference in size: 241MB vs 3MB, so those of you on metered or slow connections, | ||
- | Let’s drive this sucker! | + | Let’s drive this sucker!** |
- | To stop our running container, we simply say ‘stop’ | + | Maintenant, revenons au lien de la toute première page ^^^^^ tout en haut, et vous verrez que la syntaxe est : lxc launch < |
+ | |||
+ | lxc launch ubuntu: | ||
+ | |||
+ | Vous devez juste vous souvenir de « lxc launch », mais allons-y et faisons-le... vous savez, copier/ | ||
+ | |||
+ | Woot ! | ||
+ | |||
+ | Si vous êtes ici avec moi, bravo ! Si vous avez du mal à lancer autre chose que les exemples, tapez à nouveau lxc list et parcourez le résultat. Vous verrez NAME, URL, PROTOCOL... Cette première colonne, NAME, vous indique comment extraire quelque chose du dépôt. Si je regarde le serveur d' | ||
+ | |||
+ | Donc, lxc launch (vous vous souvenez de cela) images : (le nom dans la première colonne) alpine/3.20 (nom de la distribution/ | ||
+ | |||
+ | Alors, sommes-nous tous sur la même longueur d'onde ? Bien ! J'ai installé Ubuntu et Alpine, afin que vous puissiez voir la différence de taille : 241 Mo contre 3 Mo, donc ceux d' | ||
+ | |||
+ | Continuons ! | ||
+ | |||
+ | |||
+ | **To stop our running container, we simply say ‘stop’ | ||
lxc stop alpine | lxc stop alpine | ||
Ligne 59: | Ligne 111: | ||
Know that if you delete a container, you do *not automatically delete the image also, so don’t be afraid to delete both; you have the image, so to spin up a clone is quicker than you think! To delete images, you can use ‘image delete’ so: lxc image delete 58ec (in my case). | Know that if you delete a container, you do *not automatically delete the image also, so don’t be afraid to delete both; you have the image, so to spin up a clone is quicker than you think! To delete images, you can use ‘image delete’ so: lxc image delete 58ec (in my case). | ||
- | Pay attention to your image’s fingerprint, | + | Pay attention to your image’s fingerprint, |
- | You may have noticed that once you downloaded the image, it spun up and was ready to use immediately. If you do not want this behaviour, you can ‘copy’ the image only. | + | Pour arrêter notre conteneur en cours d' |
+ | |||
+ | lxc stop alpine | ||
+ | |||
+ | (Vous pouvez utiliser la saisie semi-automatique si vous arrêtiez « inviting-bird », par exemple.) | ||
+ | |||
+ | Si nous arrêtons quelque chose, nous pouvons le redémarrer avec start ; je vous laisse le découvrir... MDR | ||
+ | |||
+ | Nous pouvons également « supprimer » un conteneur, s'il est dans l' | ||
+ | |||
+ | lxc delete alpine | ||
+ | |||
+ | Je ne recommande pas d' | ||
+ | |||
+ | Sachez que si vous supprimez un conteneur, vous ne supprimez pas automatiquement l' | ||
+ | |||
+ | Faites attention à l’empreinte digitale de votre image ; vous devez saisir uniquement l’endroit où elle devient unique, vous n’avez pas besoin de saisir tout le texte. | ||
+ | |||
+ | |||
+ | **You may have noticed that once you downloaded the image, it spun up and was ready to use immediately. If you do not want this behaviour, you can ‘copy’ the image only. | ||
lxc image copy images: | lxc image copy images: | ||
Ligne 75: | Ligne 146: | ||
That’s it, our first dip into the ocean of containers, right on your Ubuntu desktop! Come see me next issue and we can continue, right here on FCM! | That’s it, our first dip into the ocean of containers, right on your Ubuntu desktop! Come see me next issue and we can continue, right here on FCM! | ||
- | As always, mistakes to: misc@fullcirclemagazine.org | + | As always, mistakes to: misc@fullcirclemagazine.org** |
+ | |||
+ | Vous avez peut-être remarqué qu'une fois l' | ||
+ | |||
+ | lxc image copy images: | ||
+ | |||
+ | (listez vos images et voyez). | ||
+ | |||
+ | Maintenant, si/quand j'ai besoin d' | ||
+ | |||
+ | lxc launch alpinelocal jokeapp | ||
+ | |||
+ | Cela lui donnerait l' | ||
+ | |||
+ | C'est tout, notre premier plongeon dans l' | ||
+ | |||
+ | Comme toujours, pour les erreurs, envoyez un e-mail à : misc@fullcirclemagazine.org |
issue211/tutoriel2.1732989755.txt.gz · Dernière modification : 2024/11/30 19:02 de auntiee