Created
March 16, 2022 10:41
-
-
Save othyn/ac2ae17aa9db583c1bfe51bd1a024479 to your computer and use it in GitHub Desktop.
Prints all Docker container MAC addresses with container ID and name for easy reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ID in `docker ps -q`; do | |
NAME=$(docker inspect -f '{{.Config.Image}}' "${ID}") | |
MAC=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.MacAddress}}{{end}}' "${ID}") | |
echo "${ID} :: ${MAC} :: ${NAME}"; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment