获取指定容器的ip:

  1. #Modern Docker client syntax:
  2. docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id
  3. #Old Docker client syntax:
  4. docker inspect --format '{{ .NetworkSettings.IPAddress }}' container_name_or_id
  5. Which will return just the IP address.

参考:https://github.com/LarryEitel/laravel-laradock-phpstorm
https://mozillazg.github.io/2016/01/docker-get-containers-ip-address.html