| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente |
| docker:accueil [2022/05/01 13:51] – add how to start shell in a running container phsw | docker:accueil [2026/03/16 22:26] (Version actuelle) – add how to get rate-limit current status phsw |
|---|
| ====== Docker ====== | ====== Docker ====== |
| |
| | |
| | * [[https://jakub-m.github.io/2022/09/10/docker.html|Running Docker images without Docker]] |
| | * [[https://docker-curriculum.com|Docker for beginners]] |
| | * [[https://blog.stephane-robert.info/docs/conteneurs/moteurs-conteneurs/docker-network/|Comprendre le réseau Docker]] |
| | * [[https://tbhaxor.com/docker-containers-security/#__do_not_save__|Docker Containers Security]] |
| | * [[https://danlevy.net/docker-security-tips-for-self-hosting/|Essential Docker Security Tips for Self-Hosting]] |
| | * [[https://blog.px.dev/container-filesystems/|Where are my container's files? Inspecting container filesystems]] |
| |
| |
| </code> | </code> |
| L'option ''-w'' permet de se place tout de suite dans le dossier indiqué une fois le conteneur lancé. | L'option ''-w'' permet de se place tout de suite dans le dossier indiqué une fois le conteneur lancé. |
| | |
| | |
| | ==== Copie de fichiers entre containers démarrés et hôte ==== |
| | |
| | [[https://stackoverflow.com/questions/22907231/how-to-copy-files-from-host-to-docker-container|Source]] |
| | |
| | <code bash> |
| | docker cp 77e7:/etc/php/8.1/fpm/php.ini . |
| | </code> |
| | |
| | |
| | ==== Lancer une application graphique ==== |
| | |
| | [[https://stackoverflow.com/questions/65642916/running-a-qt-gui-in-a-docker-container|Source]] |
| | |
| | <code bash> |
| | docker run -it --rm -e "DISPLAY=$DISPLAY" -v "$HOME/.Xauthority:/root/.Xauthority:ro" debian:latest |
| | </code> |
| | |
| | |
| | ==== Libérer de l'espace disque occupé par Docker ==== |
| | |
| | <code bash> |
| | sudo docker system prune -a --volumes |
| | </code> |
| |
| |
| sudo service docker restart | sudo service docker restart |
| </code> | </code> |
| | |
| | |
| | ==== Registry miroir ==== |
| | |
| | * https://docs.docker.com/docker-hub/image-library/mirror/ |
| | * https://hub.docker.com/_/registry |
| | * https://distribution.github.io/distribution/ |
| | |
| | <code bash> |
| | sudo docker run -d -p 5000:5000 -e OTEL_TRACES_EXPORTER=none -e REGISTRY_PROXY_REMOTEURL="https://registry-1.docker.io" -e REGISTRY_LOG_LEVEL=info --restart always --name registry registry:3 |
| | </code> |
| | |
| | Sur les clients, configurer dans ''/etc/docker/daemon.json'' : |
| | <code json> |
| | { |
| | "registry-mirrors": ["http://docker-mirror.homelab:5000"] |
| | } |
| | </code> |
| | |
| | Pour lister les images du registry : |
| | <code bash> |
| | curl http://docker-mirror.homelab:5000/v2/_catalog | jq |
| | </code> |
| | |
| | |
| | ==== Connaître l'état du rate-limit du Docker Hub ==== |
| | |
| | <code bash> |
| | TOKEN=$(curl --silent "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq --raw-output .token) |
| | curl --head --header "Authorization: Bearer $TOKEN" "https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest" 2>&1 | grep --ignore-case RateLimit |
| | </code> |
| | |
| | |
| | ==== Fonctionnement de Docker ==== |
| | |
| | * [[https://muhammadraza.me/2024/building-container-runtime-python/|Understanding Docker Internals: Building a Container Runtime in Python]] |