![]() ![]() ![]() ![]() This is a tricky point, because the solution itself is short and simple, but in real life you don’t use the IP address of a Docker container unless you want to test or try something on an exceptional basis.įor the above reason, I think it’s useful to read the whole post, but in case you don’t have the time, here you have the one-liner to solve the issue. If you expect that IP address might change you could go the extra mile and do something like docker container run -e 'DOCKERHOST (ip -4 addr show docker0 grep -Po inet K d. How do I get the IP address of a Docker container? tl dr The latter is the actual IP address of our agent. Then, run docker inspect, which returns a huge JSON file with all the information about the. First, you’ll need to find the ID or name of the container you want to get the information for, which you can do with: docker ps. Right at the end of the output you will see the gateway and the IP address. If you just want the IP address though, it’s pretty simple to get from the host OS. Type docker inspect and insert the container ID. Let’s shed some light on a questions that readers often ask me in email or comments. Let’s go back to CLI to find our agent zabbix-agent:alpine-4.0-latest. Why would you need the IP address of a Docker container?.
0 Comments
Leave a Reply. |