Get the IP address

Modified: 28 Apr 2022 01:26 UTC

There are a number of ways to get your container's IP address. Read below to learn about triton-docker inspect or watch the screencast to see that method and more in action.

You can quickly get your container's IP address is with triton-docker inspect. One way to use triton-docker inspect is with Go templating.

$ triton-docker inspect --format '{{ .NetworkSettings.IPAddress }}' <container name>
165.225.173.195

It is also possible to use grep to get the same information. triton-docker inspect <container name> | grep IPAddress will give you the same results, formatted differently.

$ triton-docker inspect <container name> | grep IPAddress
"IPAddress": "165.225.173.195"

This command will give you the container's IPAddress address. This IP address may be public, meaning it is accessible over the public internet, or private, meaning the IP is only accessible to your other containers. Docker containers on Triton are always assigned a private IP and have public IP addresses if requested by adding -p or -P to triton-docker run.

On Triton, triton ip <container name> will give you the primary IP number, without having to sort through all of the instance details. If you want all of the IPs assigned to your container, use triton instance get <container name>.

For more information about IPs and networking on Triton, read our networking and fabric user guide. Learn about managing DNS for your applications with Triton CNS.

Watch the screencast

Watch to see how you can use three different methods to get the IP address of your Docker container.