Skip to content

Instantly share code, notes, and snippets.

@mid0111
Last active August 23, 2016 01:58
Show Gist options
  • Save mid0111/388df36702e08206e689 to your computer and use it in GitHub Desktop.
Save mid0111/388df36702e08206e689 to your computer and use it in GitHub Desktop.
Create Docker machine for authentication proxy.

Set environment variables.

$ http_proxy=http://{user_name}:{user_password}@{proxy_host}:{proxy_port}
$ dns_host={dns_host_ip}

Create docker-machine.

$ docker-machine create -d virtualbox \
  --engine-env HTTP_PROXY=$http_proxy \
  --engine-env HTTPS_PROXY=$http_proxy \
  default

Set docker-machine env

$ eval "$(docker-machine env default)"
$ export NO_PROXY=$(echo $DOCKER_HOST | sed 's/tcp:\/\/\([^:]*\).*/\1/')

Pass env args for docker build

$ docker build . --build-arg http_proxy=http://807180:ひみつ@ないしょ:8080 --build-arg https_proxy=http://807180:ひみつ@ないしょ:8080 -t jenkins:node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment