Skip to content

Instantly share code, notes, and snippets.

@ukayani
Created November 21, 2017 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ukayani/3251f5fb79d85f1716673dd4bdb0930f to your computer and use it in GitHub Desktop.
Save ukayani/3251f5fb79d85f1716673dd4bdb0930f to your computer and use it in GitHub Desktop.
Bootstrapping docker image with Docker Mirror
#!/bin/bash
DOCKER_MIRROR_HOST=$(/sbin/ip route | awk '/default/ { print $3 }')
DOCKER_MIRROR_PORT=${MIRROR_PORT:-9001}
DOCKER_MIRROR="http://$DOCKER_MIRROR_HOST:$DOCKER_MIRROR_PORT"
# HOSTNAME is the Docker container ID, docker initializes this variable to the container ID
# APP_PORT is the container Port
export HOST_IP=$(curl $DOCKER_MIRROR/hostip)
export HOST_PORT=$(curl $DOCKER_MIRROR/container/$HOSTNAME/port/$APP_PORT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment