Merge pull request 'Demo/docker' (#18) from demo/docker into main

Reviewed-on: #18
This commit was merged in pull request #18.
This commit is contained in:
xavier committed 2026-11-21 20:27:37 +01:00
commit abd1f7f4b2
19 files changed
+2713 -3

No files matched your search

+13
View File
@@ -18,6 +18,8 @@ This repository contains a collection of LXD profiles and network configurations
![Create a profile from its YAML file with lxc](demo/lxc.gif) ![Create a profile from its YAML file with lxc](demo/lxc.gif)
<sub>▶ [asciinema recording](demo/lxc.cast)</sub>
### Tour of the mise tasks ### Tour of the mise tasks
Welcome message when entering the directory, profile list with their state in Welcome message when entering the directory, profile list with their state in
@@ -25,6 +27,8 @@ LXD, profile content and diff between LXD and the repository.
![Welcome message, profile list, profile content and diff](demo/tour.gif) ![Welcome message, profile list, profile content and diff](demo/tour.gif)
<sub>▶ [asciinema recording](demo/tour.cast)</sub>
### Install, update and import a profile ### Install, update and import a profile
A profile is installed, then changed directly in LXD: installing it again shows A profile is installed, then changed directly in LXD: installing it again shows
@@ -33,6 +37,15 @@ repository instead.
![Install a profile, update it after a change in LXD, import it back](demo/install.gif) ![Install a profile, update it after a change in LXD, import it back](demo/install.gif)
<sub>▶ [asciinema recording](demo/install.cast)</sub>
## Tutorials
Step-by-step use cases, from the clone of the repository to a ready instance:
- [Docker in an LXD container](demo/docker/README.en.md): install the
`docker-unprivileged` profile, launch an instance and use Docker.
## Usage ## Usage
Profiles can be used with the `lxc` client alone; [mise](https://mise.jdx.dev) Profiles can be used with the `lxc` client alone; [mise](https://mise.jdx.dev)
+13
View File
@@ -19,6 +19,8 @@ le déploiement et la gestion de conteneurs LXD.
![Création d'un profil à partir de son fichier YAML avec lxc](demo/lxc.gif) ![Création d'un profil à partir de son fichier YAML avec lxc](demo/lxc.gif)
<sub>▶ [Enregistrement asciinema](demo/lxc.cast)</sub>
### Tour des tâches mise ### Tour des tâches mise
Message d'accueil à l'entrée dans le dossier, liste des profils avec leur état Message d'accueil à l'entrée dans le dossier, liste des profils avec leur état
@@ -26,6 +28,8 @@ dans LXD, contenu d'un profil et différences entre LXD et le dépôt.
![Message d'accueil, liste des profils, contenu d'un profil et diff](demo/tour.gif) ![Message d'accueil, liste des profils, contenu d'un profil et diff](demo/tour.gif)
<sub>▶ [Enregistrement asciinema](demo/tour.cast)</sub>
### Installer, mettre à jour et importer un profil ### Installer, mettre à jour et importer un profil
Un profil est installé, puis modifié directement dans LXD : le réinstaller Un profil est installé, puis modifié directement dans LXD : le réinstaller
@@ -34,6 +38,15 @@ la modification dans le dépôt.
![Installation d'un profil, mise à jour après une modification dans LXD, puis import](demo/install.gif) ![Installation d'un profil, mise à jour après une modification dans LXD, puis import](demo/install.gif)
<sub>▶ [Enregistrement asciinema](demo/install.cast)</sub>
## Tutoriels
Des cas d'usage pas à pas, du clone du dépôt à une instance prête à servir :
- [Docker dans un conteneur LXD](demo/docker/README.md) : installer le profil
`docker-unprivileged`, lancer une instance et utiliser Docker.
## Utilisation ## Utilisation
Les profils s'utilisent avec le seul client `lxc` ; [mise](https://mise.jdx.dev) Les profils s'utilisent avec le seul client `lxc` ; [mise](https://mise.jdx.dev)
+13
View File
@@ -16,6 +16,8 @@ The `.cast` files can be played in Gitea's file view (asciinema player).
| `tour.yaml` | welcome message, `list`, `show`, `diff` (read only) | LXD | | `tour.yaml` | welcome message, `list`, `show`, `diff` (read only) | LXD |
| `lxc.yaml` | plain `lxc`, without mise: create a profile from its YAML file | LXD, profile `unattended-upgrades` not installed | | `lxc.yaml` | plain `lxc`, without mise: create a profile from its YAML file | LXD, profile `unattended-upgrades` not installed |
| `install.yaml` | `install`, diff and confirmation after a change in LXD, `import` | LXD, profile `unattended-upgrades` not installed | | `install.yaml` | `install`, diff and confirmation after a change in LXD, `import` | LXD, profile `unattended-upgrades` not installed |
| `docker/install.yaml` | [Docker tutorial](docker/README.en.md): clone the repository, install the `docker-unprivileged` profile, launch an instance and follow cloud-init | LXD, mise, no instance `docker` nor profile `docker-unprivileged` |
| `docker/usage.yaml` | [Docker tutorial](docker/README.en.md): `lxc exec`, then `lxc shell` and Docker commands in the instance | LXD, mise |
## Recording a demo ## Recording a demo
@@ -33,6 +35,17 @@ into the repository); their hidden epilogue restores the repository file as it
was and deletes the profile. These scenarios refuse to start if that profile is was and deletes the profile. These scenarios refuse to start if that profile is
already installed. already installed.
The scenarios of a tutorial live in a subdirectory (`docker/`), with their own
`setup.sh` preamble: it creates or checks what the scenario needs (instance,
profile, clone of the repository in a temporary directory), and its epilogue
removes what the demo created. These scenarios let the shell display its own
prompt (`prompt: ""` for autocast), so that the instance root shell opened by
`lxc shell` keeps its own.
`castfix.py` touches up each recording: it puts back the shell prompt that
autocast drops (at the start and after a `!Clear`) and speeds up the progress
dots of `cloud-init status --wait`.
agg draws the text itself, with fonts installed by mise in the demo environment agg draws the text itself, with fonts installed by mise in the demo environment
(nothing is installed on the system, which can be headless): (nothing is installed on the system, which can be headless):
[Inconsolata Nerd Font](https://www.nerdfonts.com) and [Inconsolata Nerd Font](https://www.nerdfonts.com) and
+13
View File
@@ -16,6 +16,8 @@ Les fichiers `.cast` se lisent dans la vue fichier de Gitea (lecteur asciinema).
| `tour.yaml` | message d'accueil, `list`, `show`, `diff` (lecture seule) | LXD | | `tour.yaml` | message d'accueil, `list`, `show`, `diff` (lecture seule) | LXD |
| `lxc.yaml` | `lxc` seul, sans mise : création d'un profil à partir de son fichier YAML | LXD, profil `unattended-upgrades` non installé | | `lxc.yaml` | `lxc` seul, sans mise : création d'un profil à partir de son fichier YAML | LXD, profil `unattended-upgrades` non installé |
| `install.yaml` | `install`, diff et confirmation après une modification dans LXD, `import` | LXD, profil `unattended-upgrades` non installé | | `install.yaml` | `install`, diff et confirmation après une modification dans LXD, `import` | LXD, profil `unattended-upgrades` non installé |
| `docker/install.yaml` | [tutoriel Docker](docker/README.md) : clone du dépôt, installation du profil `docker-unprivileged`, lancement d'une instance et suivi de cloud-init | LXD, mise, ni instance `docker` ni profil `docker-unprivileged` |
| `docker/usage.yaml` | [tutoriel Docker](docker/README.md) : `lxc exec`, puis `lxc shell` et commandes Docker dans l'instance | LXD, mise |
## Enregistrer une démo ## Enregistrer une démo
@@ -33,6 +35,17 @@ dans le dépôt) ; leur épilogue masqué remet le fichier du dépôt dans son
d'origine et supprime le profil. Ces scénarios refusent de démarrer si ce d'origine et supprime le profil. Ces scénarios refusent de démarrer si ce
profil est déjà installé. profil est déjà installé.
Les scénarios d'un tutoriel sont rangés dans un sous-dossier (`docker/`), avec
leur propre préambule `setup.sh` : il crée ou vérifie ce dont le scénario a
besoin (instance, profil, clone du dépôt dans un dossier temporaire) et son
épilogue supprime ce que la démo a créé. Ces scénarios laissent le shell
afficher lui-même son prompt (`prompt: ""` côté autocast), pour que le shell
root de l'instance ouvert par `lxc shell` garde le sien.
`castfix.py` retouche chaque enregistrement : il remet le prompt du shell que
autocast efface (au début et après un `!Clear`) et accélère les points de
progression de `cloud-init status --wait`.
agg dessine lui-même le texte, avec des polices installées par mise dans agg dessine lui-même le texte, avec des polices installées par mise dans
l'environnement de démo (rien n'est installé sur le système, qui peut être l'environnement de démo (rien n'est installé sur le système, qui peut être
sans interface graphique) : sans interface graphique) :
+44
View File
@@ -0,0 +1,44 @@
"""Post-process an autocast recording (asciicast v2), in place.
- Scenarios with an empty autocast prompt rely on the shell's own prompt (PS1):
autocast drops the very first one and the one a !Clear erases, so they are
put back (at the start, and after each screen clear).
- Progress dots (cloud-init status --wait prints one per second) are squeezed,
so that a long wait does not take a minute of the animation.
"""
import json
import re
import sys
DOT_GAP = 0.05
path = sys.argv[1]
with open(path, encoding="utf-8") as f:
header, *events = (json.loads(line) for line in f if line.strip())
ps1 = header.get("env", {}).get("PS1", "")
prompt = ps1.replace("AUTOCAST_PROMPT", "").replace("\\[", "").replace("\\]", "").replace("\\e", "\x1b")
first = next((e for e in events if e[1] == "o"), None)
if prompt and first and not first[2].startswith(prompt):
events.insert(0, [0.0, "o", prompt])
if prompt:
for event in events:
# Only autocast's own !Clear (a clear run in the shell redraws its prompt)
if event[1] == "o" and event[2] == "\r\x1b[H\x1b[2J\x1b[3J":
event[2] += prompt
shift, previous = 0.0, 0.0
for event in events:
time = event[0]
gap = time - previous
previous = time
if event[1] == "o" and re.fullmatch(r"\.+", event[2]) and gap > DOT_GAP:
shift += gap - DOT_GAP
event[0] = round(time - shift, 6)
if events:
header["duration"] = events[-1][0]
with open(path, "w", encoding="utf-8") as f:
for record in (header, *events):
f.write(json.dumps(record, ensure_ascii=False) + "\n")
+358
View File
@@ -0,0 +1,358 @@
# Docker in an LXD container, in a few minutes
🇫🇷 [Lire en français](README.md)
Need a throwaway Docker to try an image, isolate a project or run a few
services without touching your machine? An LXD system container does the job
nicely: it starts in seconds, behaves like a small, complete Ubuntu machine,
and goes away with a single command.
This tutorial starts from scratch: get this repository, install the
`docker-unprivileged` profile in LXD, launch an instance that installs Docker
by itself at first boot, then use it.
![Clone the repository, install the profile, launch the instance and follow cloud-init](install.gif)
<sub>▶ [asciinema recording](install.cast)</sub>
## What you need
- **LXD**, installed and initialized, with a user allowed to use it (member of
the `lxd` group):
```shell
sudo snap install lxd
sudo usermod --append --groups lxd "$USER" # then log in again
sudo lxd init --auto # default storage pool and lxdbr0 bridge
```
`lxc list` must answer without error. The tutorial also works with nested
LXD (LXD itself running in an LXD container): that is how the demos were
recorded.
- **[mise](https://mise.jdx.dev)**, which provides the repository tasks
(`list`, `show`, `install`…) and installs the small tools they use (`bat`,
`delta`, `gum`, `yq`):
```shell
curl https://mise.run | sh
echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc # then reopen the shell
```
mise is optional: the [Without mise](#without-mise) section gives the
equivalent with plain `lxc`.
- **git**, and **internet access** from the instances (Ubuntu packages, the
`get.docker.com` script, Docker Hub).
- About **2 GB of free disk** on the LXD storage pool.
## 1. Get the repository
```shell
git clone https://gitea.cloud.logerais.com/xavier/lxd-profiles.git
mise trust lxd-profiles
cd lxd-profiles
mise install # tools used by the tasks (bat, delta, gum, yq), once
```
`mise trust` allows mise to load the repository configuration (`mise.toml`):
for safety, mise ignores configuration files it has not been explicitly told
to trust. Entering the directory displays a welcome message listing the
available tasks.
## 2. Choose and install the profile
Let's first see what the repository offers around Docker, and what is already
installed in LXD:
```shell
mise run list | grep --extended-regexp 'PROFIL|docker'
```
```
PROFIL DESCRIPTION UTILISÉ FICHIER
⬜ docker A profile that deploy docker in an LXD container - profiles/containerization/docker.profile.yaml
⬜ docker-unprivileged A profile that deploy docker in an unprivileged L… - profiles/containerization/docker-unprivileged.profile.yaml
...
```
⬜ means "in the repository, not installed in LXD yet". Two profiles install
Docker:
- `docker` creates a **privileged** container: root in the container is root
on the host. It is the most permissive one, for the cases that require it.
- `docker-unprivileged` keeps the container **unprivileged** (root in the
container is an unprivileged user on the host). That is the one used here,
and it is enough for the vast majority of images.
Let's look at its content:
```shell
mise run show docker-unprivileged
```
```yaml
name: docker-unprivileged
description: "A profile that deploy docker in an unprivileged LXD container"
config:
linux.kernel_modules: overlay
security.nesting: "true"
# Requis pour les images dont les couches créent des device nodes ou des xattrs
security.syscalls.intercept.mknod: "true"
security.syscalls.intercept.setxattr: "true"
cloud-init.vendor-data: |
#cloud-config
package_update: true
package_upgrade: true
packages:
- curl
runcmd:
- curl https://get.docker.com | sh
timezone: Europe/Paris
locale: fr_FR.UTF-8
```
Nothing magic:
- `security.nesting` allows containers inside the container: Docker needs it
to create its own.
- `linux.kernel_modules: overlay` loads on the host the module of the
filesystem Docker uses for its images.
- the two `security.syscalls.intercept.*` let LXD handle, on behalf of the
container, the system calls some images make when their layers are
extracted, which an unprivileged container is not allowed to make.
- `cloud-init.vendor-data` is the first boot recipe: system update, then
Docker installation with the official script.
Install it in LXD:
```shell
mise run install docker-unprivileged
mise run list | grep --extended-regexp 'PROFIL|docker-unprivileged' # ✅: up to date in LXD
```
## 3. Launch the instance and follow its installation
`ubuntu:lts` is the latest Ubuntu LTS release (26.04 at the time of writing).
A profile is added at launch, after the `default` profile (which brings the
disk and the network):
```shell
lxc launch ubuntu:lts docker --profile default --profile docker-unprivileged
```
The instance starts in seconds, but cloud-init is still working in the
background: package upgrade, then Docker installation, about a minute. To wait
for the end and get the summary, errors included (`errors: []` when all went
well):
```shell
lxc exec docker -- cloud-init status --wait --long
```
To follow the installation live instead, the cloud-init log reads like any
file (Ctrl+C to stop):
```shell
lxc exec docker -- tail --follow /var/log/cloud-init-output.log
```
Once done, Docker is there:
```shell
lxc exec docker -- docker version --format 'Docker {{.Server.Version}}'
lxc list docker
```
The instance has two IPv4 addresses: its `eth0` interface on the LXD bridge,
and the `docker0` bridge Docker just created inside.
## 4. Use Docker
![hello-world with lxc exec, then a shell in the instance: nginx, docker ps, top, stats](usage.gif)
<sub>▶ [asciinema recording](usage.cast)</sub>
### From the host, with `lxc exec`
`lxc exec <instance> -- <command>` runs a command in the instance, without SSH
nor any setup. The classic:
```shell
lxc exec docker -- docker run --rm hello-world
```
### From a shell in the instance
For a real working session, `lxc shell` opens a root shell in the instance,
and Docker is used as on any machine:
```shell
lxc shell docker
```
```shell
docker run --detach --name web --publish 8080:80 nginx:alpine # a web server in the background
docker image ls # downloaded images
docker ps # running containers
docker top web --format pid,user,args # processes of the web container
docker stats --no-stream # CPU, memory, network
curl --silent localhost:8080 | grep title # nginx answers
exit # back to the host
```
## Going further
### Reach the service from the host
Port 8080 is published by Docker inside the instance. An LXD `proxy` device
makes it reachable on the host (and so from your network):
```shell
lxc config device add docker web proxy listen=tcp:0.0.0.0:8080 connect=tcp:127.0.0.1:8080
curl --silent localhost:8080 | grep title
```
If port 8080 is already taken on the host, change the `listen` one. The
repository also has ready-made profiles for that (`proxy-http`,
`proxy-https`).
### Keep Docker data in a volume, with automatic snapshots
By default, Docker images, containers and volumes live in `/var/lib/docker`,
on the instance disk: they go away with it. The `docker-volume-data` profile
mounts a dedicated LXD volume there instead, with a life of its own: it
survives the instance deletion, attaches to a new one, and is backed up
separately.
The volume must exist **before** the profile is installed, LXD checks it.
Create it on the `default` pool, the one the profile expects, and schedule
snapshots for it: one a day, kept for two weeks.
```shell
lxc storage volume create default docker-data size=20GiB
lxc storage volume set default docker-data snapshots.schedule=@daily snapshots.expiry=2w
mise run install docker-volume-data
```
Add the profile **when the instance is created**, so that Docker installs
directly on the volume:
```shell
lxc launch ubuntu:lts docker --profile default --profile docker-unprivileged --profile docker-volume-data
lxc exec docker -- findmnt --target /var/lib/docker # the volume is mounted
```
Volume snapshots are handled with `lxc storage volume`:
```shell
lxc storage volume snapshot default docker-data before-upgrade # manual snapshot
lxc storage volume info default docker-data # list of snapshots
lxc stop docker # instance stopped to restore
lxc storage volume restore default docker-data before-upgrade
lxc start docker
```
The `snapshots-daily` profile is not enough here: it schedules snapshots of
the **instance**, which do not include attached volumes. These are two
separate settings, and both can be combined.
### Adapt an installed profile to your needs
The repository profiles are a starting point. Say you want Docker data on
another, faster pool named `fast`. Copy the volume (with its snapshots and
their schedule), then change the profile installed in LXD directly:
```shell
lxc stop docker
lxc storage volume copy default/docker-data fast/docker-data
lxc profile device set docker-volume-data docker-data pool=fast
lxc start docker
lxc storage volume delete default docker-data # once checked
```
The volume is **copied** rather than moved: LXD refuses to move a volume a
profile refers to. The change applies to every instance using the profile.
The installed profile no longer matches the repository, and the mise tasks
say so:
```shell
mise run list | grep docker-volume-data # 📝: installed but different
mise run diff docker-volume-data
```
```diff
--- lxd:docker-volume-data (installé)
+++ profiles/containerization/docker-volume-data.profile.yaml (dépôt)
@@ -3,7 +3,7 @@
devices:
docker-data:
path: /var/lib/docker
- pool: fast
+ pool: default
source: docker-data
type: disk
```
Two options then:
- **back to the repository version**: `mise run install docker-volume-data`
shows this diff and asks for confirmation before overwriting the profile;
- **keep your version**: `mise run import docker-volume-data` rewrites the
repository file from the installed profile. Review it with `git diff`, then
commit it in your clone (or your fork).
A volume can only be attached to one instance at a time. For a second Docker
instance, copy the profile and give it its own volume:
```shell
lxc storage volume create default docker2-data
lxc profile copy docker-volume-data docker2-volume-data
lxc profile device set docker2-volume-data docker-data source=docker2-data
```
### Combine profiles
Profiles stack at launch: instance size (`size-small`, `size-medium`…),
automatic instance snapshots (`snapshots-daily`), data volume
(`docker-volume-data`)…
```shell
lxc launch ubuntu:lts docker --profile default --profile docker-unprivileged \
--profile docker-volume-data --profile size-medium --profile snapshots-daily
```
### Clean up
The instance goes away with one command, Docker with it. The data volume
stays: delete it explicitly if no longer needed, like the profiles.
```shell
lxc delete --force docker
lxc storage volume delete default docker-data
lxc profile delete docker-volume-data
lxc profile delete docker-unprivileged
```
## Without mise
The repository files are regular LXD profiles: `lxc` is enough.
```shell
lxc profile create docker-unprivileged
lxc profile edit docker-unprivileged < profiles/containerization/docker-unprivileged.profile.yaml
lxc launch ubuntu:lts docker --profile default --profile docker-unprivileged
```
## Replaying the demos
The animations of this page are recorded from the `install.yaml` and
`usage.yaml` scenarios (see [how the demos are made](../README.en.md)):
```shell
MISE_ENV=demo mise run demo docker/install
MISE_ENV=demo mise run demo docker/usage
```
They create the `docker` instance and the `docker-unprivileged` profile, and
remove them at the end; `install` refuses to start if they already exist. In
the animation, the cloud-init wait is sped up.
+360
View File
@@ -0,0 +1,360 @@
# Docker dans un conteneur LXD, en quelques minutes
🇬🇧 [Read in English](README.en.md)
Vous voulez un Docker jetable pour tester une image, isoler un projet ou faire
tourner quelques services sans toucher à votre machine ? Un conteneur système
LXD fait très bien l'affaire : il démarre en quelques secondes, se comporte
comme une petite machine Ubuntu complète, et se supprime d'une commande.
Ce tutoriel part de zéro : on récupère ce dépôt, on installe le profil
`docker-unprivileged` dans LXD, on lance une instance qui installe Docker toute
seule au premier démarrage, puis on s'en sert.
![Clone du dépôt, installation du profil, lancement de l'instance et suivi de cloud-init](install.gif)
<sub>▶ [Enregistrement asciinema](install.cast)</sub>
## Ce qu'il vous faut
- **LXD**, installé et initialisé, avec un utilisateur qui a le droit de
l'utiliser (membre du groupe `lxd`) :
```shell
sudo snap install lxd
sudo usermod --append --groups lxd "$USER" # puis se reconnecter
sudo lxd init --auto # pool de stockage et bridge lxdbr0 par défaut
```
`lxc list` doit répondre sans erreur. Le tutoriel fonctionne aussi dans un
LXD imbriqué (LXD lui-même dans un conteneur LXD), c'est d'ailleurs dans ces
conditions qu'ont été enregistrées les démos.
- **[mise](https://mise.jdx.dev)**, qui fournit les tâches du dépôt (`list`,
`show`, `install`…) et installe les petits outils qu'elles utilisent (`bat`,
`delta`, `gum`, `yq`) :
```shell
curl https://mise.run | sh
echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc # puis rouvrir le shell
```
mise reste optionnel : la section [Sans mise](#sans-mise) donne l'équivalent
avec `lxc` seul.
- **git**, et un **accès à internet** depuis les instances (paquets Ubuntu,
script `get.docker.com`, Docker Hub).
- Environ **2 Go de disque** libres sur le pool de stockage LXD.
## 1. Récupérer le dépôt
```shell
git clone https://gitea.cloud.logerais.com/xavier/lxd-profiles.git
mise trust lxd-profiles
cd lxd-profiles
mise install # outils des tâches (bat, delta, gum, yq), une seule fois
```
`mise trust` autorise mise à charger la configuration du dépôt (`mise.toml`) :
par sécurité, mise ignore les fichiers de configuration qu'on ne lui a pas
explicitement désignés comme fiables. En entrant dans le dossier, un message
d'accueil rappelle les tâches disponibles.
## 2. Choisir et installer le profil
Commençons par voir ce que le dépôt propose autour de Docker, et ce qui est déjà
installé dans LXD :
```shell
mise run list | grep --extended-regexp 'PROFIL|docker'
```
```
PROFIL DESCRIPTION UTILISÉ FICHIER
⬜ docker A profile that deploy docker in an LXD container - profiles/containerization/docker.profile.yaml
⬜ docker-unprivileged A profile that deploy docker in an unprivileged L… - profiles/containerization/docker-unprivileged.profile.yaml
...
```
⬜ signifie « présent dans le dépôt, pas encore installé dans LXD ». Deux profils
installent Docker :
- `docker` crée un conteneur **privilégié** : root dans le conteneur est root
sur l'hôte. C'est le plus permissif, à réserver aux cas qui l'exigent.
- `docker-unprivileged` garde le conteneur **non privilégié** (root dans le
conteneur est un utilisateur sans droits sur l'hôte). C'est celui qu'on
utilise ici, et il suffit pour l'immense majorité des images.
Regardons ce qu'il contient :
```shell
mise run show docker-unprivileged
```
```yaml
name: docker-unprivileged
description: "A profile that deploy docker in an unprivileged LXD container"
config:
linux.kernel_modules: overlay
security.nesting: "true"
# Requis pour les images dont les couches créent des device nodes ou des xattrs
security.syscalls.intercept.mknod: "true"
security.syscalls.intercept.setxattr: "true"
cloud-init.vendor-data: |
#cloud-config
package_update: true
package_upgrade: true
packages:
- curl
runcmd:
- curl https://get.docker.com | sh
timezone: Europe/Paris
locale: fr_FR.UTF-8
```
Rien de magique :
- `security.nesting` autorise les conteneurs dans le conteneur : c'est ce dont
Docker a besoin pour créer les siens.
- `linux.kernel_modules: overlay` charge sur l'hôte le module du système de
fichiers utilisé par Docker pour ses images.
- les deux `security.syscalls.intercept.*` laissent LXD traiter, à la place du
conteneur, les appels système que certaines images utilisent à l'extraction
de leurs couches et qu'un conteneur non privilégié n'a pas le droit de faire.
- `cloud-init.vendor-data` est la recette du premier démarrage : mise à jour
du système, puis installation de Docker avec le script officiel.
On l'installe dans LXD :
```shell
mise run install docker-unprivileged
mise run list | grep --extended-regexp 'PROFIL|docker-unprivileged' # ✅ : à jour dans LXD
```
## 3. Lancer l'instance et suivre son installation
`ubuntu:lts` désigne la dernière version LTS d'Ubuntu (26.04 à l'écriture de ces
lignes). Un profil s'ajoute au lancement, après le profil `default` (qui
apporte le disque et le réseau) :
```shell
lxc launch ubuntu:lts docker --profile default --profile docker-unprivileged
```
L'instance démarre en quelques secondes, mais cloud-init travaille encore en
arrière-plan : mise à jour des paquets puis installation de Docker, environ une
minute. Pour attendre la fin et obtenir le bilan, erreurs éventuelles comprises
(`errors: []` quand tout s'est bien passé) :
```shell
lxc exec docker -- cloud-init status --wait --long
```
Pour suivre plutôt l'installation en direct, le journal de cloud-init se lit
comme n'importe quel fichier (Ctrl+C pour arrêter) :
```shell
lxc exec docker -- tail --follow /var/log/cloud-init-output.log
```
Une fois terminé, Docker est là :
```shell
lxc exec docker -- docker version --format 'Docker {{.Server.Version}}'
lxc list docker
```
L'instance a deux adresses IPv4 : celle de son interface `eth0` sur le bridge
LXD, et celle du bridge `docker0` que Docker vient de créer à l'intérieur.
## 4. Utiliser Docker
![hello-world avec lxc exec, puis un shell dans l'instance : nginx, docker ps, top, stats](usage.gif)
<sub>▶ [Enregistrement asciinema](usage.cast)</sub>
### Depuis l'hôte, avec `lxc exec`
`lxc exec <instance> -- <commande>` exécute une commande dans l'instance, sans
SSH ni configuration. Le grand classique :
```shell
lxc exec docker -- docker run --rm hello-world
```
### Depuis un shell dans l'instance
Pour une vraie session de travail, `lxc shell` ouvre un shell root dans
l'instance, et Docker s'utilise comme sur n'importe quelle machine :
```shell
lxc shell docker
```
```shell
docker run --detach --name web --publish 8080:80 nginx:alpine # un serveur web en arrière-plan
docker image ls # images téléchargées
docker ps # conteneurs en cours
docker top web --format pid,user,args # processus du conteneur web
docker stats --no-stream # CPU, mémoire, réseau
curl --silent localhost:8080 | grep title # nginx répond
exit # retour sur l'hôte
```
## Pour aller plus loin
### Accéder au service depuis l'hôte
Le port 8080 publié par Docker l'est dans l'instance. Un device `proxy` LXD le
rend joignable sur l'hôte (et donc depuis votre réseau) :
```shell
lxc config device add docker web proxy listen=tcp:0.0.0.0:8080 connect=tcp:127.0.0.1:8080
curl --silent localhost:8080 | grep title
```
Si le port 8080 est déjà pris sur l'hôte, changez celui de `listen`. Le dépôt
propose aussi des profils prêts à l'emploi pour ça (`proxy-http`,
`proxy-https`).
### Garder les données Docker dans un volume, avec des snapshots automatiques
Par défaut, images, conteneurs et volumes Docker vivent dans `/var/lib/docker`,
sur le disque de l'instance : ils disparaissent avec elle. Le profil
`docker-volume-data` y monte plutôt un volume LXD dédié, qui a sa propre vie :
il survit à la suppression de l'instance, se rattache à une nouvelle, et se
sauvegarde à part.
Le volume doit exister **avant** l'installation du profil, LXD le vérifie. On
le crée sur le pool `default`, celui qu'attend le profil, et on lui programme
des snapshots : un par jour, gardé deux semaines.
```shell
lxc storage volume create default docker-data size=20GiB
lxc storage volume set default docker-data snapshots.schedule=@daily snapshots.expiry=2w
mise run install docker-volume-data
```
Le profil s'ajoute **à la création** de l'instance, pour que Docker s'installe
directement sur le volume :
```shell
lxc launch ubuntu:lts docker --profile default --profile docker-unprivileged --profile docker-volume-data
lxc exec docker -- findmnt --target /var/lib/docker # le volume est bien monté
```
Les snapshots du volume se gèrent avec `lxc storage volume` :
```shell
lxc storage volume snapshot default docker-data avant-maj # snapshot manuel
lxc storage volume info default docker-data # liste des snapshots
lxc stop docker # instance arrêtée pour restaurer
lxc storage volume restore default docker-data avant-maj
lxc start docker
```
Le profil `snapshots-daily` ne suffit pas ici : il programme les snapshots de
l'**instance**, qui n'incluent pas les volumes attachés. Ce sont deux réglages
distincts, et on peut combiner les deux.
### Adapter un profil installé à son besoin
Les profils du dépôt sont un point de départ. Imaginons que vous vouliez les
données Docker sur un autre pool, plus rapide, nommé `fast`. Le volume se copie
(avec ses snapshots et leur programmation), puis on modifie directement le
profil installé dans LXD :
```shell
lxc stop docker
lxc storage volume copy default/docker-data fast/docker-data
lxc profile device set docker-volume-data docker-data pool=fast
lxc start docker
lxc storage volume delete default docker-data # une fois vérifié
```
Le volume se **copie** plutôt qu'il ne se déplace : LXD refuse de déplacer un
volume auquel un profil fait référence. La modification s'applique à toutes les
instances qui utilisent le profil.
Le profil installé ne correspond plus au dépôt, et les tâches mise le
signalent :
```shell
mise run list | grep docker-volume-data # 📝 : installé mais différent
mise run diff docker-volume-data
```
```diff
--- lxd:docker-volume-data (installé)
+++ profiles/containerization/docker-volume-data.profile.yaml (dépôt)
@@ -3,7 +3,7 @@
devices:
docker-data:
path: /var/lib/docker
- pool: fast
+ pool: default
source: docker-data
type: disk
```
Deux options s'offrent alors à vous :
- **revenir à la version du dépôt** : `mise run install docker-volume-data`
affiche ce diff et demande confirmation avant d'écraser le profil ;
- **garder votre version** : `mise run import docker-volume-data` réécrit le
fichier du dépôt à partir du profil installé. À relire avec `git diff`, puis
à commiter dans votre clone (ou votre fork).
Un volume ne peut être attaché qu'à une seule instance à la fois. Pour une
deuxième instance Docker, copiez le profil et donnez-lui son propre volume :
```shell
lxc storage volume create default docker2-data
lxc profile copy docker-volume-data docker2-volume-data
lxc profile device set docker2-volume-data docker-data source=docker2-data
```
### Combiner les profils
Les profils s'empilent au lancement : taille de l'instance (`size-small`,
`size-medium`…), snapshots automatiques de l'instance (`snapshots-daily`),
volume de données (`docker-volume-data`)…
```shell
lxc launch ubuntu:lts docker --profile default --profile docker-unprivileged \
--profile docker-volume-data --profile size-medium --profile snapshots-daily
```
### Faire le ménage
L'instance se supprime d'une commande, Docker avec. Le volume de données, lui,
reste : à supprimer explicitement s'il ne sert plus, comme les profils.
```shell
lxc delete --force docker
lxc storage volume delete default docker-data
lxc profile delete docker-volume-data
lxc profile delete docker-unprivileged
```
## Sans mise
Les fichiers du dépôt sont des profils LXD ordinaires : `lxc` suffit.
```shell
lxc profile create docker-unprivileged
lxc profile edit docker-unprivileged < profiles/containerization/docker-unprivileged.profile.yaml
lxc launch ubuntu:lts docker --profile default --profile docker-unprivileged
```
## Rejouer les démos
Les animations de cette page sont enregistrées à partir des scénarios
`install.yaml` et `usage.yaml` (voir [comment sont produites les démos](../README.md)) :
```shell
MISE_ENV=demo mise run demo docker/install
MISE_ENV=demo mise run demo docker/usage
```
Ils créent l'instance `docker` et le profil `docker-unprivileged`, puis les
suppriment à la fin ; `install` refuse de démarrer s'ils existent déjà.
Dans l'animation, l'attente de cloud-init est accélérée.
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 887 KiB

+49
View File
@@ -0,0 +1,49 @@
# Demo: Docker in an LXD container, from the clone of the repository to a ready instance
# (prerequisites: LXD, mise, no instance "docker" nor profile docker-unprivileged; removed at the end)
settings:
width: 156
height: 36
type_speed: 35ms
# Empty: the prompts are the shell's own (PS1), so that the instance's root shell keeps its own prompt
prompt: ""
timeout: 300s
# bash without rc files: the real prompt (PS1) is used to detect the end of commands
shell:
program: bash
args: [--norc, --noprofile]
prompt: AUTOCAST_PROMPT
line_split: " \\"
quit_command: exit
environment:
- {name: PS1, value: "\\[\\e[1;34m\\]lxd\\[\\e[0m\\] > AUTOCAST_PROMPT"}
- {name: PROMPT_COMMAND, value: "bind 'set enable-bracketed-paste off'"}
- {name: TERM, value: xterm-256color}
instructions:
- !Command {command: "source demo/docker/setup.sh install", hidden: true}
- !Marker Clone
- !Command {command: "# Get the repository and trust its mise configuration"}
- !Command {command: "git clone https://gitea.cloud.logerais.com/xavier/lxd-profiles.git"}
- !Command {command: "mise trust lxd-profiles"}
- !Command {command: "cd lxd-profiles"}
- !Wait 4s
- !Clear
- !Marker Profile
- !Command {command: "# Docker profiles available in the repository, not installed in LXD yet"}
- !Command {command: "mise run list | grep --extended-regexp 'PROFIL|docker'"}
- !Wait 3s
- !Command {command: "mise run show docker-unprivileged"}
- !Wait 4s
- !Command {command: "mise run install docker-unprivileged"}
- !Command {command: "mise run list | grep --extended-regexp 'PROFIL|docker-unprivileged'"}
- !Wait 3s
- !Clear
- !Marker Launch
- !Command {command: "# Launch an instance with the profile: cloud-init installs Docker at first boot"}
- !Command {command: "lxc launch ubuntu:lts docker --profile default --profile docker-unprivileged"}
- !Command {command: "lxc exec docker -- cloud-init status --wait --long"}
- !Wait 2s
- !Command {command: "lxc exec docker -- docker version --format 'Docker {{.Server.Version}}'"}
- !Command {command: "lxc list docker"}
- !Wait 6s
- !Command {command: "demo_cleanup", hidden: true}
+52
View File
@@ -0,0 +1,52 @@
# shellcheck shell=bash
# Hidden preamble of the Docker demos (autocast), sourced from the repository root.
# source demo/docker/setup.sh install # nothing in LXD, fresh clone in a temporary directory
# source demo/docker/setup.sh usage # instance "docker" ready (created if missing)
# demo_cleanup (epilogue) removes what the demo created.
eval "$(mise activate bash)"
DEMO_INSTANCE=docker
DEMO_PROFILE=docker-unprivileged
DEMO_REPO=$PWD
DEMO_CREATED=
# Root shell of the instance, made recordable: its prompt ends with the marker
# autocast waits for, and its input is not echoed twice (no readline, no tty echo)
demo_instance_shell() {
lxc exec "$DEMO_INSTANCE" -- sh -c "cat >> /root/.bashrc" <<'RC'
PS1='\[\e[1;32m\]root@docker\[\e[0m\]:\w# AUTOCAST_PROMPT'
set +o emacs; stty -echo
RC
}
case "$1" in
install)
if lxc info "$DEMO_INSTANCE" >/dev/null 2>&1 || lxc profile show "$DEMO_PROFILE" >/dev/null 2>&1; then
echo "Instance $DEMO_INSTANCE or profile $DEMO_PROFILE already exists in LXD: the demo would remove them" >&2
exit 1
fi
DEMO_CREATED=yes
DEMO_TMP=$(mktemp -d)
cd "$DEMO_TMP" || exit 1
;;
usage)
if ! lxc info "$DEMO_INSTANCE" >/dev/null 2>&1; then
DEMO_CREATED=yes
mise run install --yes "$DEMO_PROFILE" >/dev/null
lxc launch ubuntu:lts "$DEMO_INSTANCE" --profile default --profile "$DEMO_PROFILE" >/dev/null
lxc exec "$DEMO_INSTANCE" -- cloud-init status --wait >/dev/null
fi
demo_instance_shell
;;
esac
demo_cleanup() {
cd "$DEMO_REPO" || return
if [ -n "$DEMO_TMP" ]; then
mise trust --untrust "$DEMO_TMP/lxd-profiles" >/dev/null 2>&1
rm -rf "$DEMO_TMP"
fi
if [ -n "$DEMO_CREATED" ]; then
lxc delete --force "$DEMO_INSTANCE" >/dev/null 2>&1
lxc profile delete "$DEMO_PROFILE" >/dev/null 2>&1
fi
}
+500
View File
@@ -0,0 +1,500 @@
{"version": 2, "width": 156, "height": 36, "timestamp": 1795286979, "duration": 38.410937, "env": {"PS1": "\\[\\e[1;34m\\]lxd\\[\\e[0m\\] > AUTOCAST_PROMPT", "PROMPT_COMMAND": "bind 'set enable-bracketed-paste off'", "TERM": "xterm-256color", "SHELL": "/usr/bin/bash"}}
[0.0, "o", "\u001b[1;34mlxd\u001b[0m > "]
[0.0, "o", ""]
[0.0, "m", "Exec"]
[0.035, "o", "#"]
[0.07, "o", " "]
[0.105, "o", "R"]
[0.14, "o", "u"]
[0.175, "o", "n"]
[0.21, "o", " "]
[0.245, "o", "a"]
[0.28, "o", " "]
[0.315, "o", "c"]
[0.35, "o", "o"]
[0.385, "o", "m"]
[0.42, "o", "m"]
[0.455, "o", "a"]
[0.49, "o", "n"]
[0.525, "o", "d"]
[0.56, "o", " "]
[0.595, "o", "i"]
[0.63, "o", "n"]
[0.665, "o", " "]
[0.7, "o", "t"]
[0.735, "o", "h"]
[0.77, "o", "e"]
[0.805, "o", " "]
[0.84, "o", "i"]
[0.875, "o", "n"]
[0.91, "o", "s"]
[0.945, "o", "t"]
[0.98, "o", "a"]
[1.015, "o", "n"]
[1.05, "o", "c"]
[1.085, "o", "e"]
[1.12, "o", " "]
[1.155, "o", "f"]
[1.19, "o", "r"]
[1.225, "o", "o"]
[1.26, "o", "m"]
[1.295, "o", " "]
[1.33, "o", "t"]
[1.365, "o", "h"]
[1.4, "o", "e"]
[1.435, "o", " "]
[1.47, "o", "h"]
[1.505, "o", "o"]
[1.54, "o", "s"]
[1.575, "o", "t"]
[1.61, "o", "\r\n"]
[1.613552, "o", "\u001b[1;34mlxd\u001b[0m > "]
[1.613553, "o", ""]
[1.648553, "o", "l"]
[1.683553, "o", "x"]
[1.718553, "o", "c"]
[1.753553, "o", " "]
[1.788553, "o", "e"]
[1.823553, "o", "x"]
[1.858553, "o", "e"]
[1.893553, "o", "c"]
[1.928553, "o", " "]
[1.963553, "o", "d"]
[1.998553, "o", "o"]
[2.033553, "o", "c"]
[2.068553, "o", "k"]
[2.103553, "o", "e"]
[2.138553, "o", "r"]
[2.173553, "o", " "]
[2.208553, "o", "-"]
[2.243553, "o", "-"]
[2.278553, "o", " "]
[2.313553, "o", "d"]
[2.348553, "o", "o"]
[2.383553, "o", "c"]
[2.418553, "o", "k"]
[2.453553, "o", "e"]
[2.488553, "o", "r"]
[2.523553, "o", " "]
[2.558553, "o", "r"]
[2.593553, "o", "u"]
[2.628553, "o", "n"]
[2.663553, "o", " "]
[2.698553, "o", "-"]
[2.733553, "o", "-"]
[2.768553, "o", "r"]
[2.803553, "o", "m"]
[2.838553, "o", " "]
[2.873553, "o", "h"]
[2.908553, "o", "e"]
[2.943553, "o", "l"]
[2.978553, "o", "l"]
[3.013553, "o", "o"]
[3.048553, "o", "-"]
[3.083553, "o", "w"]
[3.118553, "o", "o"]
[3.153553, "o", "r"]
[3.188553, "o", "l"]
[3.223553, "o", "d"]
[3.258553, "o", "\r\n"]
[3.389595, "o", "Unable to find image 'hello-world:latest' locally\r\n"]
[4.179716, "o", "latest: Pulling from library/hello-world\r\n"]
[4.587887, "o", "\r\n\u001b[1A\u001b[2K\r4f55086f7dd0: Pulling fs layer \r\u001b[1B"]
[4.800305, "o", "\u001b[1A\u001b[2K\r4f55086f7dd0: Download complete \r\u001b[1B"]
[4.800585, "o", "\u001b[1A\u001b[2K\r4f55086f7dd0: Extracting 1 s\r\u001b[1B"]
[4.90106, "o", "\u001b[1A\u001b[2K\r4f55086f7dd0: Pull complete \r\u001b[1B"]
[4.999717, "o", "\r\n\u001b[1A\u001b[2K\rd5e71e642bf5: Download complete \r\u001b[1B"]
[5.031106, "o", "Digest: sha256:1e4c05b897a751332ce85c7e9449da2d93514ea2dea6dbb0e2753c9e949b2bfa\r\nStatus: Downloaded newer image for hello-world:latest\r\n"]
[5.431539, "o", "\r\nHello from Docker!\r\nThis message shows that your installation appears to be working correctly.\r\n\r\nTo generate this message, Docker took the following steps:\r\n 1. The Docker client contacted the Docker daemon.\r\n 2. The Docker daemon pulled the \"hello-world\" image from the Docker Hub.\r\n (amd64)\r\n 3. The Docker daemon created a new container from that image which runs the\r\n executable that produces the output you are currently reading.\r\n 4. The Docker daemon streamed that output to the Docker client, which sent it\r\n to your terminal.\r\n\r\nTo try something more ambitious, you can run an Ubuntu container with:\r\n $ docker run -it ubuntu bash\r\n\r\nShare images, automate workflows, and more with a free Docker ID:\r\n https://hub.docker.com/\r\n\r\nFor more examples and ideas, visit:\r\n https://docs.docker.com/get-started/\r\n\r\n"]
[5.650193, "o", "\u001b[1;34mlxd\u001b[0m > "]
[5.650194, "o", ""]
[9.685194, "o", "\r\u001b[H\u001b[2J\u001b[3J\u001b[1;34mlxd\u001b[0m > "]
[9.720194, "o", ""]
[9.720194, "m", "Shell"]
[9.755194, "o", "#"]
[9.790194, "o", " "]
[9.825194, "o", "O"]
[9.860194, "o", "r"]
[9.895194, "o", " "]
[9.930194, "o", "o"]
[9.965194, "o", "p"]
[10.000194, "o", "e"]
[10.035194, "o", "n"]
[10.070194, "o", " "]
[10.105194, "o", "a"]
[10.140194, "o", " "]
[10.175194, "o", "s"]
[10.210194, "o", "h"]
[10.245194, "o", "e"]
[10.280194, "o", "l"]
[10.315194, "o", "l"]
[10.350194, "o", " "]
[10.385194, "o", "i"]
[10.420194, "o", "n"]
[10.455194, "o", " "]
[10.490194, "o", "t"]
[10.525194, "o", "h"]
[10.560194, "o", "e"]
[10.595194, "o", " "]
[10.630194, "o", "i"]
[10.665194, "o", "n"]
[10.700194, "o", "s"]
[10.735194, "o", "t"]
[10.770194, "o", "a"]
[10.805194, "o", "n"]
[10.840194, "o", "c"]
[10.875194, "o", "e"]
[10.910194, "o", " "]
[10.945194, "o", "a"]
[10.980194, "o", "n"]
[11.015194, "o", "d"]
[11.050194, "o", " "]
[11.085194, "o", "u"]
[11.120194, "o", "s"]
[11.155194, "o", "e"]
[11.190194, "o", " "]
[11.225194, "o", "D"]
[11.260194, "o", "o"]
[11.295194, "o", "c"]
[11.330194, "o", "k"]
[11.365194, "o", "e"]
[11.400194, "o", "r"]
[11.435194, "o", " "]
[11.470194, "o", "a"]
[11.505194, "o", "s"]
[11.540194, "o", " "]
[11.575194, "o", "o"]
[11.610194, "o", "n"]
[11.645194, "o", " "]
[11.680194, "o", "a"]
[11.715194, "o", "n"]
[11.750194, "o", "y"]
[11.785194, "o", " "]
[11.820194, "o", "m"]
[11.855194, "o", "a"]
[11.890194, "o", "c"]
[11.925194, "o", "h"]
[11.960194, "o", "i"]
[11.995194, "o", "n"]
[12.030194, "o", "e"]
[12.065194, "o", "\r\n"]
[12.068484, "o", "\u001b[1;34mlxd\u001b[0m > "]
[12.068484, "o", ""]
[12.103484, "o", "l"]
[12.138484, "o", "x"]
[12.173484, "o", "c"]
[12.208484, "o", " "]
[12.243484, "o", "s"]
[12.278484, "o", "h"]
[12.313484, "o", "e"]
[12.348484, "o", "l"]
[12.383484, "o", "l"]
[12.418484, "o", " "]
[12.453484, "o", "d"]
[12.488484, "o", "o"]
[12.523484, "o", "c"]
[12.558484, "o", "k"]
[12.593484, "o", "e"]
[12.628484, "o", "r"]
[12.663484, "o", "\r\n"]
[12.925736, "o", "\u001b]3008;start=f47dd143b8174c44aef0e85845074248;user=root;hostname=docker;machineid=fee09faa07ad4b838265ae23070d7d35;bootid=d0c476175ddf4367869c1347fa57e1bf;pid=4855;pidfdid=476481;comm=su;targetuser=root;sessionid=c1;type=session\u001b\\"]
[12.958744, "o", "\u001b]3008;start=67e73a71-aa8c-4553-9b2c-f6b84ded2924;type=shell;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[12.958801, "o", "\u001b[1;32mroot@docker\u001b[0m:~# "]
[12.958802, "o", ""]
[12.993802, "o", "d"]
[13.028802, "o", "o"]
[13.063802, "o", "c"]
[13.098802, "o", "k"]
[13.133802, "o", "e"]
[13.168802, "o", "r"]
[13.203802, "o", " "]
[13.238802, "o", "r"]
[13.273802, "o", "u"]
[13.308802, "o", "n"]
[13.343802, "o", " "]
[13.378802, "o", "-"]
[13.413802, "o", "-"]
[13.448802, "o", "d"]
[13.483802, "o", "e"]
[13.518802, "o", "t"]
[13.553802, "o", "a"]
[13.588802, "o", "c"]
[13.623802, "o", "h"]
[13.658802, "o", " "]
[13.693802, "o", "-"]
[13.728802, "o", "-"]
[13.763802, "o", "n"]
[13.798802, "o", "a"]
[13.833802, "o", "m"]
[13.868802, "o", "e"]
[13.903802, "o", " "]
[13.938802, "o", "w"]
[13.973802, "o", "e"]
[14.008802, "o", "b"]
[14.043802, "o", " "]
[14.078802, "o", "-"]
[14.113802, "o", "-"]
[14.148802, "o", "p"]
[14.183802, "o", "u"]
[14.218802, "o", "b"]
[14.253802, "o", "l"]
[14.288802, "o", "i"]
[14.323802, "o", "s"]
[14.358802, "o", "h"]
[14.393802, "o", " "]
[14.428802, "o", "8"]
[14.463802, "o", "0"]
[14.498802, "o", "8"]
[14.533802, "o", "0"]
[14.568802, "o", ":"]
[14.603802, "o", "8"]
[14.638802, "o", "0"]
[14.673802, "o", " "]
[14.708802, "o", "n"]
[14.743802, "o", "g"]
[14.778802, "o", "i"]
[14.813802, "o", "n"]
[14.848802, "o", "x"]
[14.883802, "o", ":"]
[14.918802, "o", "a"]
[14.953802, "o", "l"]
[14.988802, "o", "p"]
[15.023802, "o", "i"]
[15.058802, "o", "n"]
[15.093802, "o", "e"]
[15.128802, "o", "\r\n"]
[15.131429, "o", "\u001b]3008;start=e9896e4b-9153-4d0f-9036-87dcf1fc25b5;type=command;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[15.150233, "o", "Unable to find image 'nginx:alpine' locally\r\n"]
[15.941977, "o", "alpine: Pulling from library/nginx\r\n"]
[16.316446, "o", "\r\n\u001b[1A"]
[16.316513, "o", "\u001b[2K\rc4f3d97811f6: Pulling fs layer \r\u001b[1B\r\n\u001b[1A\u001b[2K\r4c8c172c6586: Pulling fs layer \r\u001b[1B\r\n\u001b[1A\u001b[2K\r1dc588c89da1: Pulling fs layer \r\u001b[1B\r\n\u001b[1A\u001b[2K\r04c3905a997c: Pulling fs layer \r"]
[16.316611, "o", "\u001b[1B\r\n\u001b[1A\u001b[2K\r881fc932939e: Pulling fs layer \r\u001b[1B\r\n\u001b[1A\u001b[2K\r77a3bfea78f5: Pulling fs layer \r"]
[16.316651, "o", "\u001b[1B\r\n"]
[16.31674, "o", "\u001b[1A\u001b[2K\r7cb374baf968: Pulling fs layer \r\u001b[1B\r\n\u001b[1A\u001b[2K\r61d8f4c85a74: Pulling fs layer \r\u001b[1B"]
[16.473039, "o", "\u001b[6A\u001b[2K\r1dc588c89da1: Downloading [==================================================>] 1.211kB/1.211kB\r\u001b[6B"]
[16.574533, "o", "\u001b[8A\u001b[2K\rc4f3d97811f6: Downloading [=======> ] 3.146MB/20.54MB\r\u001b[8B"]
[16.574952, "o", "\u001b[6A\u001b[2K\r1dc588c89da1: Download complete \r\u001b[6B"]
[16.673185, "o", "\u001b[8A\u001b[2K\rc4f3d97811f6: Downloading [===================================> ] 14.68MB/20.54MB\r\u001b[8B"]
[16.673215, "o", "\u001b[7A\u001b[2K\r4c8c172c6586: Download complete \r\u001b[7B"]
[16.772966, "o", "\u001b[8A\u001b[2K\rc4f3d97811f6: Downloading [==================================================>] 20.54MB/20.54MB\r\u001b[8B"]
[16.773287, "o", "\u001b[5A\u001b[2K\r04c3905a997c: Download complete \r\u001b[5B"]
[16.873596, "o", "\u001b[4A\u001b[2K\r881fc932939e: Downloading [==================================================>] 3.854MB/3.854MB\r\u001b[4B\u001b[3A\u001b[2K\r77a3bfea78f5: Download complete \r\u001b[3B"]
[16.874183, "o", "\u001b[8A\u001b[2K\rc4f3d97811f6: Download complete \r\u001b[8B"]
[16.97324, "o", "\u001b[4A\u001b[2K\r881fc932939e: Download complete \r\u001b[4B"]
[16.97344, "o", "\u001b[2A\u001b[2K\r7cb374baf968: Download complete \r\u001b[2B"]
[16.975038, "o", "\u001b[1A\u001b[2K\r61d8f4c85a74: Download complete \r\u001b[1B"]
[16.975102, "o", "\u001b[4A\u001b[2K\r881fc932939e: Extracting 1 s\r\u001b[4B"]
[17.077256, "o", "\u001b[4A\u001b[2K\r881fc932939e: Extracting 1 s\r\u001b[4B"]
[17.17391, "o", "\r\n\u001b[1A\u001b[2K\r79979b969278: Download complete \r\u001b[1B\r\n\u001b[1A\u001b[2K\r33247e384332: Download complete \r\u001b[1B"]
[17.174943, "o", "\u001b[5A\u001b[2K\r77a3bfea78f5: Extracting 1 s\r\u001b[5B"]
[17.175715, "o", "\u001b[6A\u001b[2K\r881fc932939e: Pull complete \r\u001b[6B"]
[17.273773, "o", "\u001b[5A\u001b[2K\r77a3bfea78f5: Extracting 1 s\r\u001b[5B"]
[17.373839, "o", "\u001b[5A\u001b[2K\r77a3bfea78f5: Extracting 1 s\r\u001b[5B"]
[17.473053, "o", "\u001b[7A\u001b[2K\r04c3905a997c: Pull complete \r\u001b[7B"]
[17.473286, "o", "\u001b[5A\u001b[2K\r77a3bfea78f5: Pull complete \r\u001b[5B"]
[17.573198, "o", "\u001b[9A\u001b[2K\r4c8c172c6586: "]
[17.573314, "o", "Extracting 1 s\r\u001b[9B"]
[17.576072, "o", "\u001b[4A\u001b[2K\r7cb374baf968: Pull complete \r\u001b[4B"]
[17.673476, "o", "\u001b[9A\u001b[2K\r4c8c172c6586: Pull complete \r\u001b[9B"]
[17.774558, "o", "\u001b[8A\u001b[2K\r1dc588c89da1: Pull complete \r\u001b[8B"]
[17.775077, "o", "\u001b[3A\u001b[2K\r61d8f4c85a74: Pull complete \r\u001b[3B"]
[17.872955, "o", "\u001b[10A\u001b[2K\rc4f3d97811f6: Extracting 1 s\r\u001b[10B"]
[17.972908, "o", "\u001b[10A\u001b[2K\rc4f3d97811f6: Extracting 1 s\r\u001b[10B"]
[18.073757, "o", "\u001b[10A\u001b[2K\rc4f3d97811f6: Extracting 1 s\r\u001b[10B"]
[18.173261, "o", "\u001b[10A\u001b[2K\r"]
[18.173287, "o", "c4f3d97811f6: Extracting 1 s\r\u001b[10B"]
[18.275577, "o", "\u001b[10A\u001b[2K\rc4f3d97811f6: Extracting 1 s\r\u001b[10B"]
[18.374885, "o", "\u001b[10A\u001b[2K\rc4f3d97811f6: Extracting 1 s\r\u001b[10B"]
[18.5277, "o", "\u001b[10A\u001b[2K\rc4f3d97811f6: Pull complete \r\u001b[10BDigest: sha256:fb4658584bd9a916ffb6f6e365f97c25cfdb2923801f551ea08356e695f14ff7\r\nStatus: Downloaded newer image for nginx:alpine\r\n"]
[18.731387, "o", "ab8f9a702c7bffc0c25dee09bb104432756d3d5a6ee427d223346d4756dab06f\r\n"]
[19.004927, "o", "\u001b]3008;end=e9896e4b-9153-4d0f-9036-87dcf1fc25b5;exit=success\u001b\\"]
[19.005922, "o", "\u001b]3008;start=67e73a71-aa8c-4553-9b2c-f6b84ded2924;type=shell;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[19.006125, "o", "\u001b[1;32mroot@docker\u001b[0m:~# "]
[19.006126, "o", ""]
[21.041126, "o", "c"]
[21.076126, "o", "l"]
[21.111126, "o", "e"]
[21.146126, "o", "a"]
[21.181126, "o", "r"]
[21.216126, "o", "\r\n"]
[21.21896, "o", "\u001b]3008;start=da689da0-870f-4a43-9823-65b02972ad2f;type=command;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[21.219711, "o", "\u001b[H\u001b[2J\u001b[3J"]
[21.219934, "o", "\u001b]3008;end=da689da0-870f-4a43-9823-65b02972ad2f;exit=success\u001b\\"]
[21.220987, "o", "\u001b]3008;start=67e73a71-aa8c-4553-9b2c-f6b84ded2924;type=shell;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[21.221082, "o", "\u001b[1;32mroot@docker\u001b[0m:~# "]
[21.221084, "o", ""]
[21.256084, "o", "d"]
[21.291084, "o", "o"]
[21.326084, "o", "c"]
[21.361084, "o", "k"]
[21.396084, "o", "e"]
[21.431084, "o", "r"]
[21.466084, "o", " "]
[21.501084, "o", "i"]
[21.536084, "o", "m"]
[21.571084, "o", "a"]
[21.606084, "o", "g"]
[21.641084, "o", "e"]
[21.676084, "o", " "]
[21.711084, "o", "l"]
[21.746084, "o", "s"]
[21.781084, "o", "\r\n"]
[21.783106, "o", "\u001b]3008;start=b5588bea-23dc-4b85-b8b6-2cc3e5b5be09;type=command;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[21.84173, "o", " \u001b[1m\u001b[106m\u001b[30mi\u001b[0m\u001b[0m \u001b[96mInfo → \u001b[0m\u001b[0m \u001b[38;5;0m\u001b[48;5;14m U \u001b[0m In Use\r\n\u001b[39m\u001b[1mIMAGE\u001b[0m \u001b[39m\u001b[1mID\u001b[0m \u001b[39m\u001b[1mDISK USAGE\u001b[0m \u001b[39m\u001b[1mCONTENT SIZE\u001b[0m \u001b[39m\u001b[1mEXTRA\u001b[0m\r\n\u001b[34m\u001b[1mhello-world:latest\u001b[0m \u001b[39m1e4c05b897a7\u001b[0m \u001b[39m21.8kB\u001b[0m \u001b[39m9.49kB\u001b[0m "]
[21.84178, "o", " \r\n\u001b[34m\u001b[1mnginx:alpine\u001b[0m \u001b[39mfb4658584bd9\u001b[0m \u001b[39m95.7MB\u001b[0m"]
[21.841786, "o", " "]
[21.841826, "o", " \u001b[39m27.2MB\u001b[0m \u001b[38;5;0m\u001b[48;5;14m U \u001b[0m \r\n"]
[21.843327, "o", "\u001b]3008;end=b5588bea-23dc-4b85-b8b6-2cc3e5b5be09;exit=success\u001b\\"]
[21.844612, "o", "\u001b]3008;start=67e73a71-aa8c-4553-9b2c-f6b84ded2924;type=shell;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[21.844725, "o", "\u001b[1;32mroot@docker\u001b[0m:~# "]
[21.844726, "o", ""]
[21.879726, "o", "d"]
[21.914726, "o", "o"]
[21.949726, "o", "c"]
[21.984726, "o", "k"]
[22.019726, "o", "e"]
[22.054726, "o", "r"]
[22.089726, "o", " "]
[22.124726, "o", "p"]
[22.159726, "o", "s"]
[22.194726, "o", "\r\n"]
[22.196199, "o", "\u001b]3008;start=d666be6e-1560-4e8b-97a3-3df5b8c6a43a;type=command;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[22.344064, "o", "CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\r\nab8f9a702c7b nginx:alpine \"/docker-entrypoint.…\" 1 second ago Up Less than a second 0.0.0.0:8080->80/tcp, [::]:8080->80/tcp web"]
[22.344275, "o", "\r\n"]
[22.347778, "o", "\u001b]3008;end=d666be6e-1560-4e8b-97a3-3df5b8c6a43a;exit=success\u001b\\"]
[22.349015, "o", "\u001b]3008;start=67e73a71-aa8c-4553-9b2c-f6b84ded2924;type=shell;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\\u001b[1;32mroot@docker\u001b[0m:~# "]
[22.349017, "o", ""]
[25.384017, "o", "d"]
[25.419017, "o", "o"]
[25.454017, "o", "c"]
[25.489017, "o", "k"]
[25.524017, "o", "e"]
[25.559017, "o", "r"]
[25.594017, "o", " "]
[25.629017, "o", "t"]
[25.664017, "o", "o"]
[25.699017, "o", "p"]
[25.734017, "o", " "]
[25.769017, "o", "w"]
[25.804017, "o", "e"]
[25.839017, "o", "b"]
[25.874017, "o", " "]
[25.909017, "o", "-"]
[25.944017, "o", "-"]
[25.979017, "o", "f"]
[26.014017, "o", "o"]
[26.049017, "o", "r"]
[26.084017, "o", "m"]
[26.119017, "o", "a"]
[26.154017, "o", "t"]
[26.189017, "o", " "]
[26.224017, "o", "p"]
[26.259017, "o", "i"]
[26.294017, "o", "d"]
[26.329017, "o", ","]
[26.364017, "o", "u"]
[26.399017, "o", "s"]
[26.434017, "o", "e"]
[26.469017, "o", "r"]
[26.504017, "o", ","]
[26.539017, "o", "a"]
[26.574017, "o", "r"]
[26.609017, "o", "g"]
[26.644017, "o", "s"]
[26.679017, "o", "\r\n"]
[26.683916, "o", "\u001b]3008;start=af83704b-8810-40b6-9fcd-82d7b305ce33;type=command;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[26.732146, "o", "PID "]
[26.732493, "o", " USER COMMAND\r\n4972 root nginx: master process nginx -g daemon off;\r\n5069 uuidd nginx: worker process\r\n5070 uuidd nginx: worker process\r\n5071 uuidd nginx: worker process\r\n5072 uuidd nginx: worker process\r\n5073 uuidd nginx: worker process\r\n5074 uuidd nginx: worker process\r\n5075 uuidd nginx: worker process\r\n5076 uuidd nginx: worker process\r\n"]
[26.737186, "o", "\u001b]3008;end=af83704b-8810-40b6-9fcd-82d7b305ce33;exit=success\u001b\\"]
[26.742742, "o", "\u001b]3008;start=67e73a71-aa8c-4553-9b2c-f6b84ded2924;type=shell;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[26.742874, "o", "\u001b[1;32mroot@docker\u001b[0m:~# "]
[26.742874, "o", ""]
[26.777874, "o", "d"]
[26.812874, "o", "o"]
[26.847874, "o", "c"]
[26.882874, "o", "k"]
[26.917874, "o", "e"]
[26.952874, "o", "r"]
[26.987874, "o", " "]
[27.022874, "o", "s"]
[27.057874, "o", "t"]
[27.092874, "o", "a"]
[27.127874, "o", "t"]
[27.162874, "o", "s"]
[27.197874, "o", " "]
[27.232874, "o", "-"]
[27.267874, "o", "-"]
[27.302874, "o", "n"]
[27.337874, "o", "o"]
[27.372874, "o", "-"]
[27.407874, "o", "s"]
[27.442874, "o", "t"]
[27.477874, "o", "r"]
[27.512874, "o", "e"]
[27.547874, "o", "a"]
[27.582874, "o", "m"]
[27.617874, "o", "\r\n"]
[27.620797, "o", "\u001b]3008;start=9c1b1896-28e7-4939-97fc-b22e7276d14c;type=command;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[28.684325, "o", "CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS\r\nab8f9a702c7b web 0.00% 7.492MiB / 30.26GiB 0.02% 486B / 84B 0B / 0B 9\r\n"]
[28.685855, "o", "\u001b]3008;end=9c1b1896-28e7-4939-97fc-b22e7276d14c;exit=success\u001b\\"]
[28.686694, "o", "\u001b]3008;start=67e73a71-aa8c-4553-9b2c-f6b84ded2924;type=shell;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[28.686793, "o", "\u001b[1;32mroot@docker\u001b[0m:~# "]
[28.686794, "o", ""]
[31.721794, "o", "c"]
[31.756794, "o", "u"]
[31.791794, "o", "r"]
[31.826794, "o", "l"]
[31.861794, "o", " "]
[31.896794, "o", "-"]
[31.931794, "o", "-"]
[31.966794, "o", "s"]
[32.001794, "o", "i"]
[32.036794, "o", "l"]
[32.071794, "o", "e"]
[32.106794, "o", "n"]
[32.141794, "o", "t"]
[32.176794, "o", " "]
[32.211794, "o", "l"]
[32.246794, "o", "o"]
[32.281794, "o", "c"]
[32.316794, "o", "a"]
[32.351794, "o", "l"]
[32.386794, "o", "h"]
[32.421794, "o", "o"]
[32.456794, "o", "s"]
[32.491794, "o", "t"]
[32.526794, "o", ":"]
[32.561794, "o", "8"]
[32.596794, "o", "0"]
[32.631794, "o", "8"]
[32.666794, "o", "0"]
[32.701794, "o", " "]
[32.736794, "o", "|"]
[32.771794, "o", " "]
[32.806794, "o", "g"]
[32.841794, "o", "r"]
[32.876794, "o", "e"]
[32.911794, "o", "p"]
[32.946794, "o", " "]
[32.981794, "o", "t"]
[33.016794, "o", "i"]
[33.051794, "o", "t"]
[33.086794, "o", "l"]
[33.121794, "o", "e"]
[33.156794, "o", "\r\n"]
[33.158312, "o", "\u001b]3008;start=a50685b3-5a5e-400b-a458-eb5e7c2a9c9c;type=command;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[33.16577, "o", "<\u001b[01;31m\u001b[Ktitle\u001b[m\u001b[K>Welcome to nginx!</\u001b[01;31m\u001b[Ktitle\u001b[m\u001b[K>\r\n"]
[33.174303, "o", "\u001b]3008;end=a50685b3-5a5e-400b-a458-eb5e7c2a9c9c;exit=success\u001b\\"]
[33.185051, "o", "\u001b]3008;start=67e73a71-aa8c-4553-9b2c-f6b84ded2924;type=shell;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\"]
[33.185188, "o", "\u001b[1;32mroot@docker\u001b[0m:~# "]
[33.185189, "o", ""]
[33.220189, "o", "e"]
[33.255189, "o", "x"]
[33.290189, "o", "i"]
[33.325189, "o", "t"]
[33.360189, "o", "\r\n"]
[33.36201, "o", "\u001b]3008;start=ed6629cc-3a7a-40c1-8634-070845bf7603;type=command;machineid=fee09faa07ad4b838265ae23070d7d35;user=root;hostname=docker;bootid=d0c47617-5ddf-4367-869c-1347fa57e1bf;pid=4879;cwd=/root\u001b\\logout\r\n"]
[33.362538, "o", "\u001b]3008;end=f47dd143b8174c44aef0e85845074248\u001b\\"]
[33.375937, "o", "\u001b[1;34mlxd\u001b[0m > "]
[33.375937, "o", ""]
[38.410937, "o", "\r\n"]
Binary file not shown.

After

Width:  |  Height:  |  Size: 389 KiB

+44
View File
@@ -0,0 +1,44 @@
# Demo: using Docker in the LXD instance, with lxc exec then from a shell in the instance
# (prerequisites: LXD, mise; instance "docker" created with its profile if missing, then removed at the end)
settings:
width: 156
height: 36
type_speed: 35ms
# Empty: the prompts are the shell's own (PS1), so that the instance's root shell keeps its own prompt
prompt: ""
timeout: 300s
# bash without rc files: the real prompt (PS1) is used to detect the end of commands
shell:
program: bash
args: [--norc, --noprofile]
prompt: AUTOCAST_PROMPT
line_split: " \\"
quit_command: exit
environment:
- {name: PS1, value: "\\[\\e[1;34m\\]lxd\\[\\e[0m\\] > AUTOCAST_PROMPT"}
- {name: PROMPT_COMMAND, value: "bind 'set enable-bracketed-paste off'"}
- {name: TERM, value: xterm-256color}
instructions:
- !Command {command: "source demo/docker/setup.sh usage", hidden: true}
- !Marker Exec
- !Command {command: "# Run a command in the instance from the host"}
- !Command {command: "lxc exec docker -- docker run --rm hello-world"}
- !Wait 4s
- !Clear
- !Marker Shell
- !Command {command: "# Or open a shell in the instance and use Docker as on any machine"}
- !Command {command: "lxc shell docker"}
- !Command {command: "docker run --detach --name web --publish 8080:80 nginx:alpine"}
- !Wait 2s
- !Command {command: "clear"}
- !Command {command: "docker image ls"}
- !Command {command: "docker ps"}
- !Wait 3s
- !Command {command: "docker top web --format pid,user,args"}
- !Command {command: "docker stats --no-stream"}
- !Wait 3s
- !Command {command: "curl --silent localhost:8080 | grep title"}
- !Command {command: "exit"}
- !Wait 5s
- !Command {command: "demo_cleanup", hidden: true}
+3 -2
View File
@@ -10,14 +10,15 @@
"http:noto-color-emoji" = { version = "2026-09-24", url = "https://github.com/googlefonts/noto-emoji/raw/v2026-09-24-unicode18_0/2D/fonts/NotoColorEmoji.ttf" } "http:noto-color-emoji" = { version = "2026-09-24", url = "https://github.com/googlefonts/noto-emoji/raw/v2026-09-24-unicode18_0/2D/fonts/NotoColorEmoji.ttf" }
[tasks.demo] [tasks.demo]
description = "Enregistre une démo (demo/<nom>.cast avec autocast, puis demo/<nom>.gif avec agg)" description = "Enregistre une démo (demo/<nom>.cast avec autocast, retouché par demo/castfix.py, puis demo/<nom>.gif avec agg)"
usage = ''' usage = '''
arg "<name>" help="Scénario (demo/<name>.yaml)" { arg "<name>" help="Scénario (demo/<name>.yaml)" {
choices "tour" "install" "lxc" choices "tour" "install" "lxc" "docker/install" "docker/usage"
} }
''' '''
run = ''' run = '''
autocast --overwrite "demo/${usage_name}.yaml" "demo/${usage_name}.cast" autocast --overwrite "demo/${usage_name}.yaml" "demo/${usage_name}.cast"
python3 -I demo/castfix.py "demo/${usage_name}.cast"
agg --quiet --theme monokai \ agg --quiet --theme monokai \
--font-dir "$(mise where github:ryanoasis/nerd-fonts)" \ --font-dir "$(mise where github:ryanoasis/nerd-fonts)" \
--font-dir "$(mise where http:noto-color-emoji)" \ --font-dir "$(mise where http:noto-color-emoji)" \
@@ -16,6 +16,8 @@ config:
users: users:
- name: rip - name: rip
# uid 1000 : correspond au raw.idmap de volume-homedir-Musique
uid: 1000
groups: sudo groups: sudo
shell: /bin/bash shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL'] sudo: ['ALL=(ALL) NOPASSWD:ALL']
@@ -46,4 +48,8 @@ config:
mise use -g pipx:streamrip mise use -g pipx:streamrip
runcmd: runcmd:
# Si un volume est monté sous /home/rip (volume-homedir-Musique), LXD crée
# /home/rip en root avant cloud-init : on le rend à rip et on copie le skel
- chown rip:rip /home/rip
- sudo -u rip cp -rn /etc/skel/. /home/rip/
- sudo -u rip /tmp/setup-mise.bash - sudo -u rip /tmp/setup-mise.bash
@@ -1,8 +1,10 @@
name: docker-volume-data name: docker-volume-data
description: "A profile that add a volume for docker data" description: "A profile that add a volume for docker data"
# Le volume doit exister avant l'installation du profil (LXD le vérifie) :
# lxc storage volume create default docker-data
devices: devices:
docker-data: docker-data:
type: disk type: disk
pool: btrfs pool: default
source: docker-data source: docker-data
path: /var/lib/docker path: /var/lib/docker
@@ -0,0 +1,9 @@
name: volume-homedir-Musique
description: Volume montant le dossier Musique du homedir du host (à utiliser avec app-streamrip)
config:
raw.idmap: both 1000 1000
devices:
musique:
type: disk
source: /home/xavier/Musique
path: /home/rip/Musique
@@ -0,0 +1,9 @@
name: volume-homedir
description: Volume montant le homedir du host (/home/xavier)
config:
raw.idmap: both 1000 1000
devices:
homedir:
type: disk
source: /home/xavier
path: /home/xavier