informatique:docker:compose
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 | ||
informatique:docker:compose [2019/01/16 13:20] – [Un exemple de fichier de conf] florian | informatique:docker:compose [2025/01/14 11:19] (Version actuelle) – modification externe 127.0.0.1 | ||
---|---|---|---|
Ligne 9: | Ligne 9: | ||
* Être plus confortable pour gérer mon lot de dockers web avec Traefik. Voir [[: | * Être plus confortable pour gérer mon lot de dockers web avec Traefik. Voir [[: | ||
- | * Centraliser (sous git) des fichiers de confs pour la création de mes dockers. Aujourd' | + | * Centraliser (sous git) des fichiers de confs pour la création de mes dockers. Aujourd' |
- | C'est promis, fini les docker run à rallonge {{http:// | + | C'est promis, fini les dockers runs à rallonge {{http:// |
===== Installation ===== | ===== Installation ===== | ||
- | On prend la [[https:// | + | On prend la [[https:// |
< | < | ||
Ligne 22: | Ligne 21: | ||
curl -L https:// | curl -L https:// | ||
chmod +x / | chmod +x / | ||
+ | |||
</ | </ | ||
Ligne 30: | Ligne 30: | ||
Créer un fichier de configuration '' | Créer un fichier de configuration '' | ||
- | < | + | docker-compose.yml |
+ | |||
+ | < | ||
version: ' | version: ' | ||
services: | services: | ||
Ligne 38: | Ligne 40: | ||
Nginx_2: | Nginx_2: | ||
image: richarvey/ | image: richarvey/ | ||
+ | |||
</ | </ | ||
Ligne 44: | Ligne 47: | ||
< | < | ||
docker-compose up -d | docker-compose up -d | ||
+ | |||
</ | </ | ||
Ligne 64: | Ligne 68: | ||
| | | | ||
| | ||
+ | |||
</ | </ | ||
Exemple pour vérifier si compose entend bien plusieurs fichiers avec la directive '' | Exemple pour vérifier si compose entend bien plusieurs fichiers avec la directive '' | ||
- | |||
< | < | ||
+ | |||
docker-compose -f service-a/ | docker-compose -f service-a/ | ||
+ | |||
</ | </ | ||
La documentation associée : [[https:// | La documentation associée : [[https:// | ||
- | ===== Un exemple | + | ===== Exemples |
- | Transposer ce docker run en fichier de conf : | + | ==== Transposition simple ==== |
+ | Transposer ce docker run en fichier de conf : | ||
< | < | ||
+ | |||
docker run -d --restart=always --name=" | docker run -d --restart=always --name=" | ||
-p 8081:80 \ | -p 8081:80 \ | ||
Ligne 84: | Ligne 92: | ||
-v / | -v / | ||
richarvey/ | richarvey/ | ||
+ | |||
</ | </ | ||
- | Seul petit bémol, on ne peut pas faire interpreter | + | Seul petit bémol, on ne peut pas faire interpréter |
- | <code yaml docker-compose.yml> | + | |
+ | docker-compose.yml | ||
+ | |||
+ | <code yaml> | ||
version: ' | version: ' | ||
services: | services: | ||
Ligne 100: | Ligne 112: | ||
volumes: | volumes: | ||
- / | - / | ||
+ | |||
</ | </ | ||
+ | ==== Transposition avec construction Dockerfile ==== | ||
+ | |||
+ | Remplacer une construction à partir d'un Dockerfile puis le lancement : | ||
+ | |||
+ | < | ||
+ | docker build --no-cache -t " | ||
+ | docker run -d --restart=always --name=" | ||
+ | |||
+ | </ | ||
+ | |||
+ | Par : | ||
+ | |||
+ | docker-compose.yml | ||
+ | |||
+ | <code yaml> | ||
+ | version: " | ||
+ | services: | ||
+ | mon_super_service: | ||
+ | build: | ||
+ | context: . | ||
+ | dockerfile: Dockerfile | ||
+ | image: ma_super_image | ||
+ | container_name: | ||
+ | restart: always | ||
+ | |||
+ | </ | ||
===== Ressources ===== | ===== Ressources ===== | ||
- | La documentation officielle de compose : [[https:// | + | ==== Documentation Web ==== |
+ | |||
+ | La documentation officielle de compose : [[https:// | ||
+ | Intérêt : [[http:// | ||
+ | Installation de l' | ||
+ | |||
+ | ==== Github privé ==== | ||
+ | |||
+ | Là où je positionne mes configurations compose : [[https:// | ||
informatique/docker/compose.1547644835.txt.gz · Dernière modification : 2025/01/14 11:19 (modification externe)