issue199:c_c
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue199:c_c [2023/11/25 18:37] – créée auntiee | issue199:c_c [2023/11/27 17:39] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | Now that you know how to create your own web server, I want us to look into web applications. For this we will start with Docker. Now if you know what a Snap package is, well that is basically what Docker is for web applications. | + | **Now that you know how to create your own web server, I want us to look into web applications. For this we will start with Docker. Now if you know what a Snap package is, well that is basically what Docker is for web applications. |
Again, we will go for the low-hanging fruit and get you started as fast as I know how. (There is a lengthy install instruction on the docker homepage, but we are taking the easy route - Thanks @fleabite08). I’m going to assume you are using Ubuntu desktop. | Again, we will go for the low-hanging fruit and get you started as fast as I know how. (There is a lengthy install instruction on the docker homepage, but we are taking the easy route - Thanks @fleabite08). I’m going to assume you are using Ubuntu desktop. | ||
Ligne 10: | Ligne 10: | ||
Once it has completed, type | Once it has completed, type | ||
+ | |||
+ | sudo docker -v** | ||
+ | |||
+ | Maintenant que vous savez créer votre propre serveur Web, je voudrais examiner quelques applications Web. Pour cela, nous commencerons avec Docker. Si vous savez ce que c’est qu’un paquet Snap, eh bien, c’est essentiellement ce qu’est Docker pour les applications Web. | ||
+ | |||
+ | À nouveau, nous ferons le plus simple et je vous ferai commencer aussi rapidement que possible. (Il y a une longue instruction pour l’installation sur la page d’accueil de Docker, mais nous allons choisir la facilité – Merci @fleabite08). Je vais supposer que vous utilisez Ubuntu Desktop. | ||
+ | |||
+ | Installation | ||
+ | |||
+ | Ouvrez votre terminal et tapez : | ||
+ | |||
+ | sudo apt install docker.io -y | ||
+ | |||
+ | Quand c’est fini, tapez | ||
sudo docker -v | sudo docker -v | ||
- | OK, we have Docker, now what? Well, we need a web application. Something like Redis, but as we are starting out, let’s set our aim lower. Something everyone can appreciate and understand. | ||
- | Docker has a central repository, if you will, for all these application images. Some are public and some are private. You can go look at the images available - https:// | + | **OK, we have Docker, now what? Well, we need a web application. Something like Redis, but as we are starting out, let’s set our aim lower. Something everyone can appreciate and understand. |
+ | |||
+ | Docker has a central repository, if you will, for all these application images. Some are public and some are private. You can go look at the images available - https:// | ||
+ | |||
+ | OK, nous avons Docker, et après ? Nous avons besoin d’une application Web. Quelque chose comme Redis, mais puisque nous commençons, | ||
+ | |||
+ | Docker a un dépôt central, en quelque sorte, pour toutes les images d’application. Certaines sont publiques et d’autres sont privées. Vous pouvez allez regarder les images qui sont disponibles – https:// | ||
- | Let us try it out: | + | **Let us try it out: |
Type: | Type: | ||
Ligne 31: | Ligne 51: | ||
So what happened when you typed the command? | So what happened when you typed the command? | ||
- | Docker looked to see if you already had the application, | + | Docker looked to see if you already had the application, |
- | Let’s try a basic command, type: | + | Essayons-le |
+ | |||
+ | Tapez : | ||
+ | |||
+ | sudo docker run docker/ | ||
+ | |||
+ | ••docker run est la commande d’initialisation | ||
+ | ••docker/ | ||
+ | ••cowsay boo est le message que vous voulez sortir dans l’appli | ||
+ | |||
+ | Comme vous pouvez le constater, ce n’est pas difficile. | ||
+ | |||
+ | Bon. Qu’est-ce qui s’est passé quand vous avez tapé la commande ? | ||
+ | |||
+ | Docker a regardé pour voir si vous aviez l’application déjà et, après, a commencé à la sortir du hub Docker. | ||
+ | |||
+ | |||
+ | **Let’s try a basic command, type: | ||
docker ps | docker ps | ||
- | Everyone makes mistakes. On some distros, you cannot log in as root and you will need sudo. Be sure you have sudo or root access. As my container is no longer running, I do not see it with docker ps. I need to tack on -a, to see ALL the containers. This is the thing about containers. They are usually created to do one job, then exit, but you can have applications that continue running. To stop a running container, the keyword is stop. Can you guess the command? Stopping a container requires either its name or its ID. If you look at either, you can see it is a few characters. However, you just need to type enough for it to be unique. In our case, we have only the one, so it is easy, but if you have many, you need to be very careful here. The command: sudo docker stop <the name of YOUR container> | + | Everyone makes mistakes. On some distros, you cannot log in as root and you will need sudo. Be sure you have sudo or root access. As my container is no longer running, I do not see it with docker ps. I need to tack on -a, to see ALL the containers. This is the thing about containers. They are usually created to do one job, then exit, but you can have applications that continue running. To stop a running container, the keyword is stop. Can you guess the command? Stopping a container requires either its name or its ID. If you look at either, you can see it is a few characters. However, you just need to type enough for it to be unique. In our case, we have only the one, so it is easy, but if you have many, you need to be very careful here. The command: sudo docker stop <the name of YOUR container> |
- | If you were on the ball, you may have noticed in our command output from “docker ps -a” that the status says exited. | + | Essayons une commande de base. Tapez : |
+ | |||
+ | docker ps | ||
+ | |||
+ | Tout le monde se trompe. Dans certaines distrib. vous ne pouvez pas vous connecter comme root et vous aurez besoin de sudo. Assurez-vous d’avoir l’accès à sudo ou à root. Puisque mon conteneur ne tourne plus, je ne le vois pas avec docker ps. Il faut que j’ajoute -a pour pouvoir voir ALL (tous) les conteneurs. C’est ça le truc avec les conteneurs. Généralement, | ||
+ | |||
+ | |||
+ | **If you were on the ball, you may have noticed in our command output from “docker ps -a” that the status says exited. | ||
Now that our container came to life, did its job, and died again, we may be done with it. Time to free up some disk space. To remove a container, the command is rm, just like in the shell. To do this, the container needs to be stopped or exited. Type: | Now that our container came to life, did its job, and died again, we may be done with it. Time to free up some disk space. To remove a container, the command is rm, just like in the shell. To do this, the container needs to be stopped or exited. Type: | ||
Ligne 49: | Ligne 93: | ||
Just to make sure you do not accidentally delete the image with the rm command, to remove an image, there is a separate command, rmi. You need to make sure that no containers are running off an image, before you remove it. | Just to make sure you do not accidentally delete the image with the rm command, to remove an image, there is a separate command, rmi. You need to make sure that no containers are running off an image, before you remove it. | ||
- | Try it yourself. | + | Try it yourself. |
- | If you get an error that it cannot find your image, simply use the ID. Remember what I said earlier of it having to be unique? In my case, I have only the one, so I can type: sudo rmi 6b and it will be removed. | + | Si vous avez bien compris, vous aurez peut-être remarqué dans la sortie de « docker ps -a » que le statut dit quitté. |
+ | |||
+ | Maintenant que notre conteneur a revécu, a fait son travail et est mort à nouveau, on a probablement terminé avec. Le moment est venu de créer de l’espace disque libre. Pour enlever un conteneur, la commande est rm, exactement comme dans le shell. Pour ce faire, le conteneur doit être arrêté ou quitté. Tapez : | ||
+ | |||
+ | sudo docker rm <le nom de VOTRE conteneur> | ||
+ | |||
+ | Bien que le conteneur soit maintenant parti, l’image que vous avez récupérée dans le hub Docker reste cachée localement sur votre machine, ce qui rend la réinstallation très rapide. Pour voir les images stockées sur votre machine, utilisez la commande suivante : sudo docker images | ||
+ | |||
+ | Assurez-vous simplement de ne pas supprimer l’image accidentellement avec la commande rm. Pour enlever une image, il y a une commande distincte, rmi. Il faut être certain qu’aucun conteneur ne s’exécute à partir d’une image avant de l’enlever. | ||
+ | |||
+ | Essayez-le vous-même. | ||
+ | |||
+ | |||
+ | **If you get an error that it cannot find your image, simply use the ID. Remember what I said earlier of it having to be unique? In my case, I have only the one, so I can type: sudo rmi 6b and it will be removed. | ||
Is yours gone yet? | Is yours gone yet? | ||
Ligne 65: | Ligne 122: | ||
We will discuss this in the next issue. | We will discuss this in the next issue. | ||
- | As always, if we are boring you, drop us a line at: misc@fullcirclemagazine.org | + | As always, if we are boring you, drop us a line at: misc@fullcirclemagazine.org** |
+ | |||
+ | Si vous avez un message d’erreur disant que votre image est introuvable, | ||
+ | |||
+ | La vôtre est déjà partie ? | ||
+ | |||
+ | Nous pouvons récupérer l’image à nouveau si nécessaire, | ||
+ | |||
+ | Devoir | ||
+ | |||
+ | Récupérez l’image d' | ||
+ | |||
+ | Que s’est-il passé ??? | ||
+ | |||
+ | Nous en parlerons dans le prochain numéro. | ||
+ | |||
+ | Comme toujours, si nous vous ennuyons, dites-le-nous avec un mail : misc@fullcirclemagazine.org | ||
issue199/c_c.1700933820.txt.gz · Dernière modification : 2023/11/25 18:37 de auntiee