tech:notes_docker
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_docker [2025/03/26 09:22] – Jean-Baptiste | tech:notes_docker [2025/12/05 11:50] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 5: | Ligne 5: | ||
| Voir : | Voir : | ||
| * '' | * '' | ||
| + | * [[Scan de vulnérabilité pour les images de conteneurs]] | ||
| Voir aussi OpenContainers : | Voir aussi OpenContainers : | ||
| Ligne 16: | Ligne 17: | ||
| * https:// | * https:// | ||
| - | Script | + | Django: Mise en place de l’HTTPS via Nginx |
| - | * https://raw.githubusercontent.com/moby/moby/master/contrib/ | + | * https://nextcloud.inrae.fr/s/gtSrdE98Knp7HGf? |
| + | |||
| + | Mise en production de Django via Docker | ||
| + | * https://nextcloud.inrae.fr/ | ||
| Docker et sécurité : | Docker et sécurité : | ||
| * https:// | * https:// | ||
| - | * [[https:// | ||
| Ligne 43: | Ligne 46: | ||
| Vérifier les prérequis : | Vérifier les prérequis : | ||
| + | # https:// | ||
| + | https:// | ||
| + | |||
| + | |||
| + | |||
| - | <code bash> | ||
| - | # | ||
| - | wget https:// | ||
| - | chmod +x check-config.sh | ||
| - | ./ | ||
| - | </ | ||
| === Debian | === Debian | ||
| - | <code - / | + | '' |
| + | <code -> | ||
| GRUB_CMDLINE_LINUX=" | GRUB_CMDLINE_LINUX=" | ||
| </ | </ | ||
| Ligne 60: | Ligne 63: | ||
| update-grub | update-grub | ||
| </ | </ | ||
| + | |||
| === RedHat | === RedHat | ||
| Ligne 74: | Ligne 78: | ||
| yum install docker-latest #docker # | yum install docker-latest #docker # | ||
| </ | </ | ||
| + | |||
| === Si conf proxy Docker et SystemD | === Si conf proxy Docker et SystemD | ||
| Ligne 83: | Ligne 88: | ||
| </ | </ | ||
| - | <code ini / | + | '' |
| + | <code ini> | ||
| [Service] | [Service] | ||
| - | Environment = " | + | # Environment = " |
| + | Environment = " | ||
| </ | </ | ||
| Ligne 106: | Ligne 113: | ||
| Voir : | Voir : | ||
| + | * https:// | ||
| * https:// | * https:// | ||
| * https:// | * https:// | ||
| Ligne 115: | Ligne 123: | ||
| === Droits pour utilisateur non root | === Droits pour utilisateur non root | ||
| + | |||
| Ligne 121: | Ligne 130: | ||
| docker run -ti --privileged -v /:/host debian chroot /host | docker run -ti --privileged -v /:/host debian chroot /host | ||
| docker run -ti --userns=host --privileged -v /:/host debian chroot /host | docker run -ti --userns=host --privileged -v /:/host debian chroot /host | ||
| + | |||
| + | #List images to use one | ||
| + | docker images | ||
| + | #Run the image mounting the host disk and chroot on it | ||
| + | docker run -it -v /:/host/ ubuntu: | ||
| + | |||
| + | # Get full access to the host via ns pid and nsenter cli | ||
| + | docker run -it --rm --pid=host --privileged ubuntu bash | ||
| + | nsenter --target 1 --mount --uts --ipc --net --pid -- bash | ||
| + | |||
| + | # Get full privs in container without --privileged | ||
| + | docker run -it -v /:/host/ --cap-add=ALL --security-opt apparmor=unconfined --security-opt seccomp=unconfined --security-opt label: | ||
| + | |||
| </ | </ | ||
| + | |||
| + | Voir : | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| Voir : http:// | Voir : http:// | ||
| Ligne 137: | Ligne 165: | ||
| * Podman | * Podman | ||
| * kata-containers | * kata-containers | ||
| + | |||
| + | |||
| + | === Droits montage | ||
| + | |||
| + | <code bash> | ||
| + | docker run -v / | ||
| + | </ | ||
| + | |||
| + | |||
| + | doesn' | ||
| + | Submounts like / | ||
| Ligne 153: | Ligne 192: | ||
| ** Le fichier ''/ | ** Le fichier ''/ | ||
| - | <code - / | + | |
| + | '' | ||
| + | <code -> | ||
| # | # | ||
| </ | </ | ||
| Ligne 167: | Ligne 208: | ||
| </ | </ | ||
| - | <code javascript | + | '' |
| + | <code javascript> | ||
| { | { | ||
| " | " | ||
| Ligne 192: | Ligne 234: | ||
| systemctl daemon-reload | systemctl daemon-reload | ||
| </ | </ | ||
| + | |||
| + | |||
| == Stockage | == Stockage | ||
| Ligne 215: | Ligne 259: | ||
| </ | </ | ||
| - | <code c / | + | '' |
| + | <code c> | ||
| activation { | activation { | ||
| thin_pool_autoextend_threshold=80 | thin_pool_autoextend_threshold=80 | ||
| Ligne 234: | Ligne 279: | ||
| docker ps -a --filter volume=data-nfs3 | docker ps -a --filter volume=data-nfs3 | ||
| </ | </ | ||
| + | |||
| + | |||
| === Notes RedHat | === Notes RedHat | ||
| Ligne 244: | Ligne 291: | ||
| </ | </ | ||
| - | <code - / | + | '' |
| + | <code -> | ||
| # | # | ||
| DOCKER_STORAGE_OPTIONS=" | DOCKER_STORAGE_OPTIONS=" | ||
| Ligne 251: | Ligne 299: | ||
| Voir aussi : | Voir aussi : | ||
| * / | * / | ||
| + | |||
| === Debian | === Debian | ||
| Ligne 259: | Ligne 308: | ||
| apt-get install thin-provisioning-tools | apt-get install thin-provisioning-tools | ||
| </ | </ | ||
| + | |||
| === RedHat 7 | === RedHat 7 | ||
| Ligne 265: | Ligne 315: | ||
| à la 1ere install | à la 1ere install | ||
| - | <code ini / | + | '' |
| + | <code ini> | ||
| # This file may be automatically generated by an installation program. | # This file may be automatically generated by an installation program. | ||
| Ligne 281: | Ligne 332: | ||
| DOCKER_STORAGE_OPTIONS= | DOCKER_STORAGE_OPTIONS= | ||
| </ | </ | ||
| + | |||
| == Réseau | == Réseau | ||
| Ligne 300: | Ligne 352: | ||
| Le hôte du container est indiqué par '' | Le hôte du container est indiqué par '' | ||
| - | <code - / | + | '' |
| + | <code -> | ||
| 127.0.0.1 | 127.0.0.1 | ||
| ::1 | ::1 | ||
| Ligne 307: | Ligne 360: | ||
| 10.88.0.176 | 10.88.0.176 | ||
| </ | </ | ||
| + | |||
| + | |||
| === Conf Default bridge VLAN | === Conf Default bridge VLAN | ||
| - | <code javascript | + | '' |
| + | <code javascript> | ||
| { | { | ||
| " | " | ||
| Ligne 325: | Ligne 381: | ||
| systemctl status docker | systemctl status docker | ||
| </ | </ | ||
| + | |||
| == Import / Export images Docker | == Import / Export images Docker | ||
| Ligne 339: | Ligne 396: | ||
| docker load -i <path to image tar file> | docker load -i <path to image tar file> | ||
| </ | </ | ||
| + | |||
| + | |||
| == Debug | == Debug | ||
| Ligne 350: | Ligne 409: | ||
| systemctl stop docker-latest ; rm -rf / | systemctl stop docker-latest ; rm -rf / | ||
| </ | </ | ||
| + | |||
| == Autres | == Autres | ||
| Ligne 355: | Ligne 415: | ||
| Dépôt (Docker Registry) | Dépôt (Docker Registry) | ||
| * https:// | * https:// | ||
| + | |||
| === Architecture x86 amd64 arm | === Architecture x86 amd64 arm | ||
| Ligne 361: | Ligne 422: | ||
| docker run --platform linux/amd64 --publish 8000:8080 ghcr.io/ | docker run --platform linux/amd64 --publish 8000:8080 ghcr.io/ | ||
| </ | </ | ||
| + | |||
| === Notes brouillon | === Notes brouillon | ||
| Ligne 366: | Ligne 428: | ||
| ==== Namespace | ==== Namespace | ||
| - | Voir : https:// | + | Voir : |
| + | * https:// | ||
| + | * https:// | ||
| - | <code - / | + | '' |
| + | <code -> | ||
| dockremap: | dockremap: | ||
| </ | </ | ||
| - | <code - / | + | '' |
| + | <code -> | ||
| dockremap: | dockremap: | ||
| </ | </ | ||
| + | |||
| + | |||
| == Perf strest test pour prod | == Perf strest test pour prod | ||
| https:// | https:// | ||
| + | |||
| == Pb | == Pb | ||
| Ligne 442: | Ligne 511: | ||
| </ | </ | ||
| - | === Proxy (sous Debian) | + | |
| + | === Proxy | ||
| <code bash> | <code bash> | ||
| - | export | + | export |
| </ | </ | ||
| Ligne 553: | Ligne 623: | ||
| grep CRIT / | grep CRIT / | ||
| </ | </ | ||
| + | |||
| == Notes DNS Bind9 | == Notes DNS Bind9 | ||
| Ligne 582: | Ligne 653: | ||
| </ | </ | ||
| - | <code ini / | + | '' |
| + | <code ini> | ||
| GRUB_CMDLINE_LINUX=" | GRUB_CMDLINE_LINUX=" | ||
| </ | </ | ||
| Ligne 630: | Ligne 702: | ||
| docker save -o plop.tar.gz acme/jibe | docker save -o plop.tar.gz acme/jibe | ||
| </ | </ | ||
| + | |||
| ==== Notes console TTY | ==== Notes console TTY | ||
| Ligne 638: | Ligne 711: | ||
| If you use -t and -i then Control-C will terminate the container. When using -i with -t then you have to use Control-P Control-Q to detach without terminating. | If you use -t and -i then Control-C will terminate the container. When using -i with -t then you have to use Control-P Control-Q to detach without terminating. | ||
| + | |||
| ==== Notes Haute dispo / Cluster | ==== Notes Haute dispo / Cluster | ||
| Ligne 705: | Ligne 779: | ||
| docker run -it --volume /opt/data --name data2 busybox | docker run -it --volume /opt/data --name data2 busybox | ||
| - | docker inspect | + | docker inspect --format "{{ .Mounts }}" data2 |
| + | docker inspect -f '{{ .Mounts }}' my-container | ||
tech/notes_docker.1742977378.txt.gz · Dernière modification : de Jean-Baptiste
