Comment lister tous les conteneurs Docker, juste le nom et le nom de l'interface réseau
La commande suivante listera tous les conteneurs Docker en cours d’exécution avec leurs noms, noms d’interface réseau (interface pont) et adresses IP :
list_docker_containers.sh
docker ps -a --format "{{.Names}}" | xargs -I {} docker inspect --format "{{.Name}} {{range .NetworkSettings.Networks}}br-{{slice .NetworkID 0 12}} {{.IPAddress}}{{end}}" {}Exemple de sortie
docker_list_output.txt
/mycontainer1 br-a1b2c3d4e5f6 192.168.1.2
/web-server br-b2c3d4e5f6a1 172.17.0.3
/database-prod br-c3d4e5f6a1b2 10.0.0.15
/redis-cache br-d4e5f6a1b2c3 192.168.100.8
/nginx-proxy br-e5f6a1b2c3d4 172.20.0.4
/api-backend br-f6a1b2c3d4e5 10.1.1.23
/monitoring-stack br-1a2b3c4d5e6f 192.168.50.12
/elasticsearch-node br-2b3c4d5e6f1a 172.18.0.7Check out similar posts by category:
Docker
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow