Outils pour utilisateurs

Outils du site


issue140:tutoriel1

Ceci est une ancienne révision du document !


In my line of work I don't really get any exposure to containers, but the landscape is changing and if you want to stay relevant, you need to know. At first it was a scary prospect, until Daniel from the Full Circle Telegram group gave me a quick introduction to Vagrant. I had seen LXC on the internet, but assumed (incorrectly) that it was just another virtual machine manager. When I wanted to look into LXC, I was told about LXD, which is LXC with bells on.

Dans mon travail, je ne suis pas vraiment tourné vers les conteneurs, mais le paysage change et si vous voulez rester pertinent, vous devez les connaître. , au début, c'était une prospection effarante, jusqu'à ce que Daniel, du groupe Telegram du Full Circle, me fit une courte présentation de Vagrant. J'avais vu LXC sur Internet, mais j'en avais déduit (par erreur) que ce n'était qu'autre gestionnaire de machine virtuelle. Quand j'ai voulu regardé dans LXC, on me parlait de LXD qui est LXC avec tout le bazar.

What is LXD? LXD is an open source container management extension for Linux Containers (LXC). LXD both improves upon existing LXC features and provides new features and functionality to build and manage Linux containers.

Qu'est-ce que LXD ?

LXD est une extension de gestion de conteneurs Open Source pour les conteneurs sous Linux (LXC). LXD améliore les fonctionnalités existantes de LXC tout en fournissant de nouvelles caractéristiques et fonctionnalités pour construire et gérer les conteneurs sous Linux.

And that is? Containers are a lightweight virtualisation technology that don't emulate hardware. Take the fifty cent tour with me. We can try LXD out online without installing anything at: https://linuxcontainers.org/lxd/try-it/

Et c'est quoi ?

Les conteneurs sont une technologie de virtualisation allégée qui n'émule pas le matériel.

Faisons un petit tour rapide ensemble.

Nous pouvons tester LXD en ligne sans rien installer, à : https://linuxcontainers.org/lxd/try-it/

For those who want to try it at home, the LXD container hypervisors are supported and created by Ubuntu team, so installation is as simple as: sudo apt install lxd Our overview: 1. Set up and configure LXD 2. Create our first container 3. Launch a container

Pour ceux qui veulent l'essayer chez eux, les hyperviseurs de conteneur LXD sont supporté et créés par l'équipe d'Ubuntu ; donc, l'installation est aussi simple que :

sudo apt install lxd

Notre visite rapide : 1. Paramétrer et configurer LXD 2. Créer notre premier conteneur 3. Lancer un conteneur

Once LXD is installed, there will be a LXD group added to your list of groups. Just add your user to the group to be able to manage containers: sudo adduser gewgaw lxd Should the group not be created, add it yourself: newgrp lxd Setup

Instead of configuring LXD by hand, it comes with a handy set up: sudo lxd init You will need to answer the questions on screen to continue. This sets up the storage and networking etc. for you. Once you are done, verify your install with: lxc info LXD is built on top of LXC so the lxc commands are all valid.

Creation To create and start containers from images use the launch command: <lxc launch images: > examples: lxc launch images:centos/7/amd64 centos-c2 or: lxc launch images:opensuse/15.0/amd64 opensuse-stable-c8

Can you see the pattern? Our container is now created. To confirm it was created, we can use the command: lxc list This will give you the name of your container, the state, the IP address and if it has snapshots. All the commands are self-explanatory, starting with: lxc then what you want to do. examples: lxc start, lxc stop, lxc info, lxc delete, lxc destroy, lxc create, lxc clone, etc. You can get a lot more info here: https://help.ubuntu.com/lts/serverguide/lxc.html

LXD is typically added to the Linux kernel. Packaged LXD distributions are available for numerous Linux distributions, including Fedora, Debian, openSUSE, Ubuntu, Alpine Linux, Arch Linux and Gentoo. We can also obtain LXD builds for Windows and OSX.

Launch When you run 'lxc list', you will get a name in the first column. To start a container, simply type: 'lxc exec' and the name in that first column. For example: lxc exec centos-c2 adding “–” after the command, allows us to run a command or script in that container. Another example: lxc exec fedora28-c7 – dnf update To run a script you need to provide the full path to that script.

To work inside a container, add '– bash' to the end: lxc exec fedora28-c7 bash When you are done doing updates or installing software, simply type: exit

That is the quick overview on LXD. There is more to it, but you will pick up everything else very fast once you have this bit under your belt. Here you can find a list of commands: https://linuxcontainers.org/lxc/manpages/ Website: https://linuxcontainers.org/lxd/introduction/

issue140/tutoriel1.1546351409.txt.gz · Dernière modification : 2019/01/01 15:03 de d52fr