Advertisement
Infra_HDC

How to get a Docker container's IP address from the host

Jun 15th, 2023 (edited)
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. Modern Docker client syntax is:
  2. docker inspect \
  3. -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id
  4.  
  5. Old Docker client syntax is:
  6. docker inspect \
  7. --format '{{ .NetworkSettings.IPAddress }}' container_name_or_id
  8.  
  9. See https://stackoverflow.com/questions/17157721/how-to-get-a-docker-containers-ip-address-from-the-host
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement