« Docker scripts » : différence entre les versions
Page créée avec « == Docker clean == <syntaxhighlight lang="bash" line> #!/bin/bash # container stop function containersStop { echo "Stop all Containers" runningContainers=$(docker ps -q) if test -n "$runningContainers" then docker stop $runningContainers fi } # containers clean function containersClean { containersStop echo "Remove all Containers" docker container prune -f } # images clean function imagesClean { echo "Remove all Images" images=$(docker images -q)... » |
|||
| (3 versions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 1 : | Ligne 1 : | ||
== Docker clean == | == Docker clean == | ||
<syntaxhighlight lang="bash" line> | |||
#!/bin/bash | |||
# Arrêter tous les conteneurs en cours d'exécution | |||
docker stop $(docker ps -q) | |||
# Supprimer tous les conteneurs | |||
docker rm $(docker ps -a -q) | |||
# Supprimer toutes les images | |||
docker rmi $(docker images -q) | |||
# Supprimer tous les volumes | |||
docker volume rm $(docker volume ls -q) | |||
# clean | |||
docker system prune -f | |||
echo "Tous les conteneurs, images et volumes Docker ont été supprimés." | |||
</syntaxhighlight> | |||
== Docker clean old == | |||
<syntaxhighlight lang="bash" line> | <syntaxhighlight lang="bash" line> | ||
#!/bin/bash | #!/bin/bash | ||
| Ligne 102 : | Ligne 124 : | ||
menu "$@" | menu "$@" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Ligne 117 : | Ligne 131 : | ||
<a href="https://discordapp.com/users/284694598888980480"><img src='https://img.shields.io/badge/captnsharky-blue?logo=discord&logoColor=white' /></a> | <a href="https://discordapp.com/users/284694598888980480"><img src='https://img.shields.io/badge/captnsharky-blue?logo=discord&logoColor=white' /></a> | ||
</html> | </html> | ||
[[Catégorie:Docker]] | |||