Ceci est une ancienne révision du document !
Mise à jour des sources list:
#apt update
Instal des pré-requis:
#apt install ca-certificates curl gnupg lsb-release
Download de la clé de signature:
#curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Création du dossier key:
#mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg –dearmor -o /etc/apt/keyrings/docker.gpg
2dition de la source list:
#echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Installation de docker et dépendance:
#apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Pour tester si install ok:
#docker run hello-world
Réponse si ok:
#Hello from Docker! This message shows that your installation appears to be working correctly.
Receiving a GPG error when running apt-get update?
Your default umask may not be set correctly, causing the public key file for the repo to not be detected. Run the following command and then try to update your repo again:
#chmod a+r /etc/apt/keyrings/docker.gpg
| manipulation container | |
| démarrer container en mode détaché | docker run -d hello-word |
| Pour lister les containers inactifs/actifs | docker ps / docker ps -a |
| Pour supprimer un container | docker rm name_of_container |
| Chercher une image sur dockerhub | docker search debian |
| Télécharger une image sur dockerhub | docker image pull |
| Lister les images sur l'hôte | docker image ls |
| stopper ou demarrer un container | docker stop ou start ID_container |
| docker debug | |
| info docker | docker system info |
| Pour obtenir un shell root dans un container | docker exec -it -u root name_of_container bash ou /bin/bash |
| Pour obtenir la commande IP ADD | apt install iproute2 |
| Vérifier si docker fonctionne | docker run hello-word |
| Vérifier status service docker | systemctl status docker |
| Vérifier version docker | docker version |
| Vérifier stockage docker | docker system df |
| vérifier logs container container | docker logs ID_container |
| réseau docker | |
| démarrer container avec portforwarding hôte/container | docker run -p6000:6800 nginx |
| Vérifier les réseaux docker | docker network ls |
| Créer réseaux docker | docker network create name_reseau |
| docker-compose | |
| Pour lancer container avec fichier .yml | docker compose up -d |