Add DOCKER_HOST_IP

This commit is contained in:
Will Sargent 2017-05-20 11:40:21 -07:00 committed by GitHub
parent e112c3fb7c
commit a55230e6dd

View file

@ -628,6 +628,17 @@ or using a [go template](https://docs.docker.com/engine/reference/commandline/in
docker inspect -f '{{ .NetworkSettings.IPAddress }}' <container_name>
```
or when building an image from Dockerfile, when you want to pass in a build argument:
```
DOCKER_HOST_IP=`ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1`
echo DOCKER_HOST_IP = $DOCKER_HOST_IP
docker build \
--build-arg ARTIFACTORY_ADDRESS=$DOCKER_HOST_IP
-t sometag \
some-directory/
```
### Get port mapping
```