Outils pour utilisateurs

Outils du site


gestion_configuration:docker:toc

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
gestion_configuration:docker:toc [2022/05/20 16:56] – [Divers] sgariepygestion_configuration:docker:toc [2025/02/27 18:25] (Version actuelle) – [Docker Engine API] sgariepy
Ligne 1: Ligne 1:
- 
  
 ====== Installation de Docker ====== ====== Installation de Docker ======
Ligne 13: Ligne 12:
   * [[https://docs.docker.com/install/linux/docker-ce/ubuntu/|Get Docker CE for Ubuntu]]   * [[https://docs.docker.com/install/linux/docker-ce/ubuntu/|Get Docker CE for Ubuntu]]
   * [[https://docs.docker.com/engine/install/linux-postinstall/|Post-install]]   * [[https://docs.docker.com/engine/install/linux-postinstall/|Post-install]]
 +
 +Installation sur WSL2, sans Docker Desktop:
 +
 +  * [[https://woshub.com/install-docker-windows-wsl2/|Get Started with Docker on Windows (WSL2) without Docker Desktop]]
  
  
Ligne 237: Ligne 240:
   $ docker exec -it c1 sh   $ docker exec -it c1 sh
   $ docker exec -u 0 -it c1 sh # force le root   $ docker exec -u 0 -it c1 sh # force le root
 +
 +
 +L'alternative à ''docker exec'' est d'utiliser [[https://docs.docker.com/reference/cli/docker/debug/|docker debug]].
 +
 ==== Docker Logs ==== ==== Docker Logs ====
  
Ligne 244: Ligne 251:
      
      
 +Limiter les logs:
  
 +<code>
 +docker logs my-app --tail 100
 +docker logs my-app --since 1h
 +docker logs my-app --tail 100 --since 1h
 +</code>
 ==== Volumes ==== ==== Volumes ====
  
Ligne 263: Ligne 276:
 -v ./postgres-data:/var/lib/postgresql/data -v ./postgres-data:/var/lib/postgresql/data
 </code> </code>
 +
 +Les volumes sont localisés (linux) à : '' /var/lib/docker/volumes/''.
  
 ==== Réseau ==== ==== Réseau ====
Ligne 466: Ligne 481:
   $ docker run -dt --name c1 --network ps-ip alpine sleep 1d   $ docker run -dt --name c1 --network ps-ip alpine sleep 1d
  
 +Aussi, il serait possible d'utiliser:
 +
 +  $ docker network connect <network-name> <container-name>
  
 ===== Services réseau ===== ===== Services réseau =====
Ligne 498: Ligne 516:
 Pour savoir sur quel réseau se trouve un container: Pour savoir sur quel réseau se trouve un container:
  
-    $ docker inspect container-name -f "{{json .NetworkSettings.Networks }}" | jq +  $ docker inspect container-name -f "{{json .NetworkSettings.Networks }}" | jq 
  
  
Ligne 576: Ligne 594:
 [[https://gist.github.com/mbn18/0d6ff5cb217c36419661|Source]] [[https://gist.github.com/mbn18/0d6ff5cb217c36419661|Source]]
  
 +====== Docker Engine API ======
  
 +Ayant suivi cette procédure de [[https://stackoverflow.com/questions/37178824/how-do-i-find-the-docker-rest-api-url|StackOverflow]]
  
 +  - Editer avec ''sudo systemctl edit docker.service'' (ou ''sudo nano /lib/systemd/system/docker.service'' si le premier ne fonctionne pas, même si pas recommandé)
 +  - Ajouter (ou modifier la ligne existante) pour avoir:<code>
 +[Service]
 +...
 +ExecStart=/usr/bin/docker daemon -H fd:// -H tcp://0.0.0.0:1111
 +</code>
 +  - Recharger la configuration: ''sudo systemctl daemon-reload''
 +  - Redémarrer le service: ''sudo service docker restart''
 +  - Vérifier que le tout fonctionne: ''curl http://localhost:1111/version''
gestion_configuration/docker/toc.1653058564.txt.gz · Dernière modification : 2022/05/20 16:56 de sgariepy