Subscribed unsubscribe Subscribe Subscribe

docker machine+insecure docker registry

外に公開せず楽したい時

./insecure_docker_registry:

#!/bin/sh

ip=$(ifconfig | grep 'addr:192\.168' | awk -F' ' '{print $2}' | sed -e 's/addr://')

if_not_exist() {
  test $(cat /var/lib/boot2docker/profile | grep "insecure-registry $ip:5000" | wc -l) = 0
}

insert() {
  echo 'EXTRA_ARGS="$EXTRA_ARGS --insecure-registry '$ip':5000"' | sudo tee -a /var/lib/boot2docker/profile
}

if_not_exist && insert && sudo /etc/init.d/docker restart
$ machine=docker-dev
$ docker-machine scp ./insecure_docker_registry $machine:/tmp/
$ docker-machine ssh $machine /tmp/insecure_docker_registry