You can use the --format
option from the inspect
to get the IP address from the host. For Modern docker client use:
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name or container_id
For Old docker client use:
docker inspect --format '{{ .NetworkSettings.IPAddress }}' container_name or container_id
These commands will produce the IP address of the Docker container. As stated in the comments, use double quotes ” instead of single quotes’around the curly braces if you’re using Windows.