tech:notes_podman
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:notes_podman [2025/12/19 10:15] – Jean-Baptiste | tech:notes_podman [2026/03/23 10:20] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes Podman | ||
| + | |||
| + | Voir aussi : | ||
| + | * Apptainer/ | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * ''/ | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | Rootless : https:// | ||
| + | |||
| + | |||
| + | Volumes / Stockage / Storage : | ||
| + | * NFS : https:// | ||
| + | |||
| + | |||
| + | |||
| + | Installez slirp4netns (va être remplacé par **pasta** à partir de Podman 5) | ||
| + | ~~~bash | ||
| + | apt-get install slirp4netns | ||
| + | ~~~ | ||
| + | |||
| + | Ensuite, configurez une quantité d' | ||
| + | |||
| + | ~~~bash | ||
| + | echo " | ||
| + | sysctl -p / | ||
| + | ~~~ | ||
| + | |||
| + | Cette commande permet d' | ||
| + | |||
| + | |||
| + | ## Démarrage automatique | ||
| + | |||
| + | ~~~bash | ||
| + | systemctl --user enable --now podman-restart | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Conf registry | ||
| + | |||
| + | ''/ | ||
| + | ~~~ini | ||
| + | [registries.search] | ||
| + | registries = [' | ||
| + | |||
| + | [registries.insecure] | ||
| + | registries = [] | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Exemple | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | podman build -t jibe/ | ||
| + | |||
| + | podman run -a stdout --rm --name=dokuwiki1 -v $PWD/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Contener - entrypoint | ||
| + | ~~~ | ||
| + | $ podman run --entrypoint / | ||
| + | Test1 | ||
| + | Test2 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | #podman generate systemd --restart-policy=always -t 1 dokuwiki1 | ||
| + | #podman generate systemd --restart=always -t 1 dokuwiki1 | ||
| + | |||
| + | # podman generate systemd --new --files --name httpd | ||
| + | # quadlet ? | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Autre | ||
| + | ~~~bash | ||
| + | echo 1 > / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Conf UIDMAP | ||
| + | |||
| + | Voir `/ | ||
| + | |||
| + | | Colonne | Description | ||
| + | | ------- | ------------------------------------------------------------- | | ||
| + | | 1 | Nom de l' | ||
| + | | 2 | Numéro d'UID sur le hôte correspondant à l'UID 0 du NS | | ||
| + | | 3 | Plage; notre d'UID à l' | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | sudo usermod --add-subuids 10000-75535 USERNAME | ||
| + | sudo usermod --add-subgids 10000-75535 USERNAME | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ''/ | ||
| + | ~~~ | ||
| + | jean: | ||
| + | test: | ||
| + | plop: | ||
| + | k8s: | ||
| + | ~~~ | ||
| + | |||
| + | ''/ | ||
| + | ~~~ | ||
| + | jean: | ||
| + | test: | ||
| + | plop: | ||
| + | k8s: | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Commandes utiles | ||
| + | |||
| + | Afficher tous les mappages de ports de conteneur utilisés | ||
| + | ~~~bash | ||
| + | podman port -a | ||
| + | ~~~ | ||
| + | |||
| + | Pour un container particulier | ||
| + | ~~~bash | ||
| + | podman port ctn-app1 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | ## Réseau | ||
| + | |||
| + | Podman prend en charge 2 réseaux backend pour les conteneurs : Netavark et CNI. | ||
| + | |||
| + | Pour vérifier quel backend réseau est utilisé : | ||
| + | |||
| + | ~~~ | ||
| + | $ podman info --format {{.Host.NetworkBackend}} | ||
| + | netavark | ||
| + | ~~~ | ||
| + | |||
| + | Pour modifier le backend réseau, définissez la configuration dans ''/ | ||
| + | |||
| + | ~~~ | ||
| + | [network] | ||
| + | [...] | ||
| + | # Network backend determines what network driver will be used to set up and tear down container networks. | ||
| + | # Valid values are " | ||
| + | network_backend = " | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | La commande podman network create créer un réseau compatible DNS. | ||
| + | |||
| + | Création d’un réseau appelé db_network en spécifiant le sous-réseau 10.87.0.0/ | ||
| + | |||
| + | ~~~ | ||
| + | podman network create --gateway 10.87.0.1 --subnet 10.87.0.0/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | La commande '' | ||
| + | |||
| + | |||
| + | |||
| + | La commande '' | ||
| + | |||
| + | |||
| + | |||
| + | Re appliquer les règles réseau Podman | ||
| + | ~~~bash | ||
| + | podman network reload | ||
| + | ~~~ | ||
| + | |||
| + | Avant cette commande il faillait faire un restart des containers. | ||
| + | |||
| + | |||
| + | A common problem is that reloading the firewall deletes the netavark iptables rules resulting in a loss of network connectivity for rootful containers. | ||
| + | |||
| + | |||
| + | |||
| + | |||
