gouf
1/14/2015 - 3:51 AM

Inspect Container IP Address. ref: http://qiita.com/gologo13/items/1bdba6085ec79153bf1a

Inspect Container IP Address. ref: http://qiita.com/gologo13/items/1bdba6085ec79153bf1a

#!/bin/sh

# docker image tag name
TAG="dockerfile/mysql"

CONTAINER_ID=$(docker ps | grep $TAG | awk '{print $1}')

IP=$(docker inspect $CONTAINER_ID | python -c 'import json,sys;obj=json.load(sys.stdin);print obj[0]["NetworkSettings"]["IPAddress"]')

mysql -u admin -ppassword -h $IP