Skip to content

Instantly share code, notes, and snippets.

@othyn
Created March 16, 2022 10:41
Show Gist options
  • Save othyn/ac2ae17aa9db583c1bfe51bd1a024479 to your computer and use it in GitHub Desktop.
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
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