Skip to content

Instantly share code, notes, and snippets.

@miniharryc
Last active February 1, 2016 19:36
Show Gist options
  • Save miniharryc/2107acd083f1307f9e79 to your computer and use it in GitHub Desktop.
Save miniharryc/2107acd083f1307f9e79 to your computer and use it in GitHub Desktop.
Getting the local docker-machine IP to add to no_proxy
#
# This is the (brute force) way I'd thought to do it
eval "$(docker-machine env default)"
# get the IP address of our docker-machine,
# so we can add it to no_proxy below
DOCKER_IP=$(echo $DOCKER_HOST | sed 's#tcp://##' | sed 's#:.*##')
export no_proxy=lexmark.com,localhost,pvi.com,$DOCKER_IP
## this is the actual way to do it
eval "$(docker-machine env default --no-proxy)"
@miniharryc
Copy link
Author

Bit of explanation for the above: We use an http proxy, so any time we want some traffic to a non-proxied program launched by the shell, need to add it to the no_proxy ENV var in my ZSH rc file.

@nathanleclaire
Copy link

You can use --no-proxy flag for docker-machine env:

$ docker-machine env --no-proxy default
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/Users/nathanleclaire/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
export NO_PROXY="192.168.99.100"
# Run this command to configure your shell:
# eval $(docker-machine env --no-proxy)

@miniharryc
Copy link
Author

Indeed!

eval "$(docker-machine env default --no-proxy)"

Works like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment