« Docker Images » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| Ligne 51 : | Ligne 51 : | ||
Pour éviter toute confusion ou écrasement accidentel, vous pouvez aussi versionner votre image locale : | Pour éviter toute confusion ou écrasement accidentel, vous pouvez aussi versionner votre image locale : | ||
<syntaxhighlight lang="bash">docker tag debian:latest local/debian:2025-06</syntaxhighlight> | <syntaxhighlight lang="bash" copy>docker tag debian:latest local/debian:2025-06</syntaxhighlight> | ||
Et dans le <code>Dockerfile</code> : | Et dans le <code>Dockerfile</code> : | ||
| Ligne 69 : | Ligne 69 : | ||
Si tu avais tagué une image locale comme ceci : | Si tu avais tagué une image locale comme ceci : | ||
<syntaxhighlight lang="bash">docker tag debian:latest local/debian:latest</syntaxhighlight> | <syntaxhighlight lang="bash" copy>docker tag debian:latest local/debian:latest</syntaxhighlight> | ||
Tu peux soit : - Supprimer ce tag local : <code>bash docker rmi local/debian:latest</code> - Ou le renommer pour le conserver : <code>bash docker tag local/debian:latest local/debian:backup</code> | Tu peux soit : - Supprimer ce tag local : <code>bash docker rmi local/debian:latest</code> - Ou le renommer pour le conserver : <code>bash docker tag local/debian:latest local/debian:backup</code> | ||
| Ligne 75 : | Ligne 75 : | ||
==== 2. '''Tirer la dernière version depuis Docker Hub''' ==== | ==== 2. '''Tirer la dernière version depuis Docker Hub''' ==== | ||
<syntaxhighlight lang="bash">docker pull debian:latest</syntaxhighlight> | <syntaxhighlight lang="bash" copy>docker pull debian:latest</syntaxhighlight> | ||
Cela télécharge la version la plus récente de l’image officielle. | Cela télécharge la version la plus récente de l’image officielle. | ||
| Ligne 83 : | Ligne 83 : | ||
Si tu veux continuer à utiliser un tag local dans ton <code>Dockerfile</code> : | Si tu veux continuer à utiliser un tag local dans ton <code>Dockerfile</code> : | ||
<syntaxhighlight lang="bash">docker tag debian:latest local/debian:latest</syntaxhighlight> | <syntaxhighlight lang="bash" copy>docker tag debian:latest local/debian:latest</syntaxhighlight> | ||
<span id="rebuilder-ton-image"></span> | <span id="rebuilder-ton-image"></span> | ||
==== 4. '''Rebuilder ton image''' ==== | ==== 4. '''Rebuilder ton image''' ==== | ||
| Ligne 89 : | Ligne 89 : | ||
Ensuite, tu peux reconstruire ton image avec Docker ou Docker Compose : | Ensuite, tu peux reconstruire ton image avec Docker ou Docker Compose : | ||
<syntaxhighlight lang="bash">docker compose build --no-cache</syntaxhighlight> | <syntaxhighlight lang="bash" copy>docker compose build --no-cache</syntaxhighlight> | ||
L’option <code>--no-cache</code> garantit que tout est reconstruit à partir de la nouvelle image de base. | L’option <code>--no-cache</code> garantit que tout est reconstruit à partir de la nouvelle image de base. | ||
| Ligne 101 : | Ligne 101 : | ||
Tu peux créer un petit script <code>update-base.sh</code> : | Tu peux créer un petit script <code>update-base.sh</code> : | ||
<syntaxhighlight lang="bash">#!/bin/bash | <syntaxhighlight lang="bash" copy>#!/bin/bash | ||
docker pull debian:latest | docker pull debian:latest | ||
docker tag debian:latest local/debian:latest | docker tag debian:latest local/debian:latest | ||