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 | ||
| kb_it:docker [2022/07/07 21:09] – [Maintenir un container en vie] befe | kb_it:docker [2025/12/06 11:53] (Version actuelle) – befe | ||
|---|---|---|---|
| Ligne 41: | Ligne 41: | ||
| docker run --rm -v osx-big-sur_data:/ | docker run --rm -v osx-big-sur_data:/ | ||
| </ | </ | ||
| + | |||
| ===== Commandes secondaires ===== | ===== Commandes secondaires ===== | ||
| Ligne 49: | Ligne 50: | ||
| <code bash> | <code bash> | ||
| docker inspect -f '{{ .Created }}' IMAGE_OR_CONTAINER | docker inspect -f '{{ .Created }}' IMAGE_OR_CONTAINER | ||
| + | </ | ||
| + | |||
| + | ===== Gestion du réseau ===== | ||
| + | |||
| + | ==== Utilisation du driver macvlan ==== | ||
| + | |||
| + | Cas d' | ||
| + | |||
| + | Exposition d'un serveur DNS conténeurisé avec une @IP spécifique et communication possible entre l' | ||
| + | |||
| + | <code bash> | ||
| + | docker network create -d macvlan --subnet=192.168.0.0/ | ||
| + | </ | ||
| + | |||
| + | docker-compose.yml | ||
| + | <code yml> | ||
| + | version: " | ||
| + | |||
| + | networks: | ||
| + | befe.lan: | ||
| + | external: true | ||
| + | |||
| + | services: | ||
| + | adguard: | ||
| + | image: adguard/ | ||
| + | networks: | ||
| + | befe.lan: | ||
| + | ipv4_address: | ||
| + | ports: | ||
| + | - 192.168.0.2: | ||
| + | - 192.168.0.2: | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | ip link add befe.lan-shim link enp0s3 type macvlan mode bridge | ||
| + | ip addr add 192.168.0.253/ | ||
| + | ip link set befe.lan-shim up | ||
| + | ip route add 192.168.0.2/ | ||
| + | </ | ||
| + | |||
| + | Pour une configuration persistante : | ||
| + | |||
| + | / | ||
| + | < | ||
| + | auto befe.lan-shim | ||
| + | iface befe.lan-shim inet manual | ||
| + | pre-up | ||
| + | up /bin/ip addr add 192.168.0.253/ | ||
| + | post-up | ||
| + | post-down /bin/ip route del befe.lan-shim | ||
| + | </ | ||
| + | |||
| + | ===== Gestion du mode graphique ===== | ||
| + | |||
| + | ==== Lancer un conteneur en mode graphique ==== | ||
| + | |||
| + | <code bash> | ||
| + | docker run --rm -it \ | ||
| + | --net=host \ | ||
| + | -e DISPLAY \ | ||
| + | -v / | ||
| + | gns3/xeyes | ||
| </ | </ | ||
| Ligne 99: | Ligne 162: | ||
| RUN addgroup docker-test --gid 1000 && \ | RUN addgroup docker-test --gid 1000 && \ | ||
| adduser docker-test --debug --no-create-home --disabled-password --gecos "" | adduser docker-test --debug --no-create-home --disabled-password --gecos "" | ||
| + | </ | ||
| + | |||
| + | ===== Healthcheck ===== | ||
| + | |||
| + | ==== httpd ==== | ||
| + | |||
| + | <code yml> | ||
| + | healthcheck: | ||
| + | test: timeout 10s bash -c ':> / | ||
| + | interval: 60s | ||
| + | timeout: 30s | ||
| + | retries: 3 | ||
| </ | </ | ||
| Ligne 136: | Ligne 211: | ||
| <code yaml> | <code yaml> | ||
| entrypoint: 'tail -f / | entrypoint: 'tail -f / | ||
| + | </ | ||
| + | |||
| + | ==== Lister les PID des conteneurs ==== | ||
| + | |||
| + | <code bash> | ||
| + | for i in $(docker container ls --format " | ||
| + | </ | ||
| + | |||
| + | ==== Voir les adresses IP des conteneurs ==== | ||
| + | |||
| + | <code bash> | ||
| + | docker ps -q | xargs -n 1 docker inspect --format ' | ||
| + | </ | ||
| + | |||
| + | ==== Commandes diverses ==== | ||
| + | |||
| + | === PHP Composer et limitation de la mémoire === | ||
| + | |||
| + | <code bash> | ||
| + | docker run -it --rm -v $(pwd):/app -w /app -e COMPOSER_MEMORY_LIMIT=-1 composer: | ||
| + | </ | ||
| + | |||
| + | ===== Problèmes connus ===== | ||
| + | |||
| + | ==== MySQL/ | ||
| + | |||
| + | < | ||
| + | Error: io_setup() failed with EAGAIN after 5 attempts | ||
| + | </ | ||
| + | |||
| + | <code bash> | ||
| + | $ sysctl fs.aio-max-nr | ||
| + | fs.aio-max-nr = 65536 | ||
| + | sudo sysctl -w fs.aio-max-nr=2097152 | ||
| </ | </ | ||