Docker Engine
Container IPs
Licobox lets you reach a container directly through its internal IP address, so you can test a service without publishing a host port and without port clutter.
Install the helper
Section titled “Install the helper”licobox install-helperGet a container’s IP
Section titled “Get a container’s IP”docker inspect nginx --format '{{.NetworkSettings.IPAddress}}'docker ps --quiet | xargs -n1 docker inspect --format '{{.Name}} {{.NetworkSettings.IPAddress}}'Walk through it
Section titled “Walk through it”- Install and start
licobox-helper. - Run a container. The example uses nginx.
- Read the container’s internal IP.
- Request the container directly with
curl.
# Install the helperlicobox install-helper
# Run a containerdocker run --rm --name nginx -d nginx
# Read the container's internal IPdocker inspect nginx --format '{{.NetworkSettings.IPAddress}}'# 172.17.0.2
# Request the container directlycurl -I 172.17.0.2A working request returns something like:
HTTP/1.1 200 OKServer: nginx/1.29.7Content-Type: text/htmlContent-Length: 896Command reference
Section titled “Command reference”| Task | Command |
|---|---|
| Install the helper | licobox install-helper |
| Run a test container | docker run --rm --name nginx -d nginx |
| Get one container’s IP | docker inspect nginx --format '{{.NetworkSettings.IPAddress}}' |
| Request by IP | curl -I 172.17.0.2 |
Does the IP stay the same?
Section titled “Does the IP stay the same?”Troubleshooting
Section titled “Troubleshooting”The IP is empty
The container may not be running, or it may use a Compose network with a different address. Inspect the network settings to see every attached network:
docker inspect nginx --format '{{json .NetworkSettings.Networks}}'Connection refused when requesting the IP
The service may listen on a different port or only on localhost inside the container. Check the port it binds to, and add the port to the request:
curl -I 172.17.0.2:8080The IP changes after a restart
That is expected. Docker assigns a new IP when a container is recreated. Use Container names for a stable address, or keep the container running.