After creating a new Docker Container, you may want to get the IP Address. You can get the IP Address from the Docker Container by running a very basic ‘ipconfig‘ or yan can get this information from the Container Host.
First you must get the container ID:
PS > docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a17bf821d5d2 nanoserver/iis "powershell" 19 minutes ago Up 19 minutes checkps2
Then use the container ID to run ‘Docker inspect‘:
PS > Docker inspect <Docker_Container_Name>
You also can retrieve this information using the --format
option of inspect:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <Docker_Container_Name>
On My Container Host:
Thanks for reading! You can follow me on Twitter @PrigentNico