issue200:c_c
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue200:c_c [2023/12/30 10:37] – créée auntiee | issue200:c_c [2023/12/31 08:25] (Version actuelle) – d52fr | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | We continue from our last issue – we are still talking docker, so you can get a containerized application on your webserver. Hopefully you got stuck on your homework or the last question and did some internet research. | + | **We continue from our last issue – we are still talking docker, so you can get a containerized application on your webserver. Hopefully you got stuck on your homework or the last question and did some internet research. |
The reason “nothing” happened is because there is no application to run. The purpose of docker is to run an application and exit. An operating system is not an application. This does not mean we cannot interact with it. We can do so by tacking on a command or invoking something like an interactive terminal. | The reason “nothing” happened is because there is no application to run. The purpose of docker is to run an application and exit. An operating system is not an application. This does not mean we cannot interact with it. We can do so by tacking on a command or invoking something like an interactive terminal. | ||
- | To interact with it, we specify -it for interactive terminal (see below) and we need to give it a command, like sleep, for instance. We will ask it to run bash, the command will run and you will be asked for your computer password. However, once typed in, you will be logged into a root prompt on the docker container. | + | To interact with it, we specify -it for interactive terminal (see below) and we need to give it a command, like sleep, for instance. We will ask it to run bash, the command will run and you will be asked for your computer password. However, once typed in, you will be logged into a root prompt on the docker container. |
- | If we then run a command, it runs inside that container (see top right). Please also try this. | + | Nous continuons depuis le dernier numéro – nous parlons toujours de docker, pour que vous puissiez avoir une application conteneurisée sur votre serveur Web. J’espère que vous étiez bloqué sur les devoirs ou la dernière question et que vous avez fait quelques recherches sur l’Internet. |
+ | |||
+ | La raison pour laquelle « rien » n’est arrivé est qu’il n’y a aucune application à lancer. L’objectif de docker est de lancer une application et de quitter. Un système d’exploitation n’est pas une application. Cela ne veut pas dire que nous ne pouvons pas interagir avec. Nous pouvons le faire en ajoutant une commande ou en invoquant quelque chose comme un terminal interactif. | ||
+ | |||
+ | Pour interagir avec, nous spécifions -it pour « interactive terminal » et nous devons lui donner une commande, comme, par exemple, se mettre en veille. Nous lui demanderons d’exécuter bash, la commande s’exécutera et on vous demandera le mot de passe de votre ordinateur. Toutefois, une fois ce mot de passe saisi, vous serez connecté à une invite root sur le conteneur docker. Remarquez le changement de nom dans l’invite. Il affiche maintenant root@<id du conteneur>, | ||
+ | |||
+ | **If we then run a command, it runs inside that container (see top right). Please also try this. | ||
As you can see, I am running Ubuntu inside my docker container, inside Ubuntu Mate, inside | As you can see, I am running Ubuntu inside my docker container, inside Ubuntu Mate, inside | ||
- | Though we specifically wanted to access the terminal inside the container this time, most of the time we would not want to. A container is designed to come up and run one application until it completes, or crashes. | + | Though we specifically wanted to access the terminal inside the container this time, most of the time we would not want to. A container is designed to come up and run one application until it completes, or crashes. |
- | From the ps output (above), we can see the command we ran under the command column. I kept my terminal narrow to get a screenshot that is readable, but please make your terminal full screen. If you type: sudo docker ps - and you get no output, it means that there are no running containers, they have completed their tasks and exited. | + | Si nous lançons alors une commande, elle s’exécute à l’intérieur du conteneur. Veillez essayer cela aussi. |
+ | |||
+ | Comme vous pouvez le voir, j’exécute Ubuntu à l’intérieur de mon conteneur docker, à l’intérieur d’Ubuntu Mate, à l’intérieur d’une VM (un truc d’Inception, | ||
+ | |||
+ | Bien que, cette fois-ci, nous veuillons accéder au terminal à l’intérieur du conteneur, la plupart du temps nous ne voudrions pas le faire. Un conteneur est conçu pour se présenter et exécuter une application jusqu' | ||
+ | |||
+ | |||
+ | **From the ps output (above), we can see the command we ran under the command column. I kept my terminal narrow to get a screenshot that is readable, but please make your terminal full screen. If you type: sudo docker ps - and you get no output, it means that there are no running containers, they have completed their tasks and exited. | ||
Let’s say you typed some malformed command and now your docker container is running and eating up resources, or in the real world, your container encountered some error and you need to kill it and restart your application. Well, for that we have the stop command. | Let’s say you typed some malformed command and now your docker container is running and eating up resources, or in the real world, your container encountered some error and you need to kill it and restart your application. Well, for that we have the stop command. | ||
- | If I wanted to stop that top container, I could stop it by container id or friendly name. So in my case, I’d type: sudo docker stop friendly_kalam. I want you to run a container, with any command that will keep it alive and then stop it. Notice how long it takes. This is the power of containers. | + | If I wanted to stop that top container, I could stop it by container id or friendly name. So in my case, I’d type: sudo docker stop friendly_kalam. I want you to run a container, with any command that will keep it alive and then stop it. Notice how long it takes. This is the power of containers. |
+ | |||
+ | De la sortie de ps (ci-dessus), | ||
+ | |||
+ | Disons que vous avez tapé une commande malformée quelconque et que maintenant votre conteneur docker tourne et dévore vos ressources, ou dans le monde réel, votre conteneur a rencontré une quelconque erreur et vous devez le tuer et redémarrer votre application. Pour cela, il y a la commande stop. | ||
+ | |||
+ | Si je voulais arrêter le conteneur en haut, je pourrais le faire par l'id du conteneur ou par son nom convivial. Ainsi, dans mon cas, je taperais : sudo docker stop friendly_kalam. Je veux que vous lanciez un conteneur avec n’importe quelle commande qui la gardera en vie, puis l’arrêtez. Remarquez le temps qu’il faut pour le faire. C’est cela la puissance des conteneurs. Puisque vous savez déjà comment enlever un conteneur, je veux que vous enleviez le votre. (C’est en s’exerçant que l’on s’améliore.) | ||
+ | |||
+ | **Say we were planning ahead, and we did not want to run an image from docker hub, but we want to use it later, we can simply pull the image. This creates the image on your computer for future use. Try typing sudo docker pull nginx - and once done type: sudo docker images | ||
+ | |||
+ | Disons qu’on était en train de faire notre planification et qu’on ne voulait pas lancer une image du hub docker, mais qu’on voulait l’utiliser plus tard, nous pouvons tout simplement « pull » (récupérer) l’image. Cela crée l’image sur votre ordinateur pour que vous puissiez l’utiliser ultérieurement. Tapez : sudo docker pull nginx - et, une fois terminé, tapez : sudo docker images | ||
+ | |||
+ | **We covered the run command, the pull command, the stop command, the ps command, rm command, images command, the rmi command and yes I know they are not all commands, but it is easy to take stock this way. This means you have the basic skills to reach out to docker hub, grab an image, run it or interact with it, and remove it when you are done. I suggest that you grab images of topics you are interested in. Want to learn more about Redis? Then grab that image. It is important to note: This will get boring really fast if you are just doing this parrot fashion from my ramblings. I have given you the basic tools to get started. Try to grab “official” images of things like nginx or Redis, as you do not always know what changes have been made to unofficial images. That said, I know there are some of you out there that would want to create your own images. We can look at that in the next issue and maybe even look at the docker registry. I don’t want to dive too deep into this subject, as I am not sure what kind of interest there is out there. | ||
+ | |||
+ | If you would like to know more about the topic, you know what to do, ping me on Telegram, say something in our FCM Telegram group, or e-mail misc@fullcirclemagazine.org** | ||
- | Say we were planning ahead, and we did not want to run an image from docker hub, but we want to use it later, we can simply | + | Nous avons traité la commande |
- | We covered the run command, the pull command, the stop command, the ps command, rm command, images command, the rmi command and yes I know they are not all commands, but it is easy to take stock this way. This means you have the basic skills to reach out to docker hub, grab an image, run it or interact with it, and remove it when you are done. I suggest that you grab images of topics you are interested in. Want to learn more about Redis? Then grab that image. It is important to note: This will get boring really fast if you are just doing this parrot fashion from my ramblings. I have given you the basic tools to get started. Try to grab “official” images of things like nginx or Redis, as you do not always know what changes have been made to unofficial images. That said, I know there are some of you out there that would want to create your own images. We can look at that in the next issue and maybe even look at the docker registry. I don’t want to dive too deep into this subject, as I am not sure what kind of interest there is out there. | + | Si vous voudrez en savoir davantage, vous savez ce qu’il faut faire : me contacter sur Telegram, dire quelque chose dans le groupe FCM sur Telegram ou envoyer un mail à misc@fullcirclemagazine.org |
- | If you would like to know more about the topic, you know what to do, ping me on Telegram, say something in our FCM Telegram group, or e-mail misc@fullcirclemagazine.org |
issue200/c_c.1703929023.txt.gz · Dernière modification : 2023/12/30 10:37 de auntiee