i'm using docker desktop , I have runned prometheus as a container :
the commande docker inspect is showing that this container is running on the gateway 172.17.0.2 on port 9090 .
"Networks": { "bridge": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "a112bcf4dbabbfdb5b3e14c9d286469a482557c78d42854a5ae3e754ca44fd5d", "EndpointID": "0ecc79513b555daebb51947a6a6a73bb26f0974542a6f79d14013b8b1572a589", "Gateway": "172.17.0.1", "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:11:00:02", "DriverOpts": null } }
but when this address is not rechable in my browser .
could any one please help
CodePudding user response:
That's correct: you can't access the docker inspect
IP address on a Windows host. You also can't access it from a MacOS host, if your Docker is more explicitly inside a virtual machine (using Docker Toolbox or a tool like Minikube for your Docker environment), or if you're calling from a different host from the container. This IP address is almost never useful and you shouldn't need to look it up at all.
When you start a container, you have the option to publish ports from it. If Prometheus normally listens on port 9000, this could look like
docker run \
-d \ # in the background
--name prometheus \ # with a name so it's easier to manage
-p 9123:9000 \ # host port 9123 -> container port 9000
bitnami/prometheus
The second port number must exactly match what the image is expecting. The first port number can be anything that's not otherwise in use. The ports are frequently the same but don't have to be.
Once you have this docker run -p
option, you can use the first port number to access the container; http://localhost:9123
if you're on the same host (and aren't using Docker Toolbox or a similar VM-based setup).
If you don't have this option, docker stop
and docker rm
the existing container and docker run
a new one with the right settings. This is extremely routine, very similar to using Ctrl C to stop a command-line process and then run it with different command-line arguments.