Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get docker container ip
#!/usr/bin/env bash
#inside docker container
HOST_IP=$(/sbin/ip route|awk '/default/ { print $3 }')
CONTAINER_IP=$(curl "$HOST_IP:8000" 2>/dev/null)
echo "container ip is $CONTAINER_IP"
#!/usr/bin/env bash
#then run something like this inside ./host
php -S
#!/bin/env php
# ./host/index.php on host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.