This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# apt-get install jq | |
#set -eu | |
shopt -s nullglob | |
readonly base_dir=$1 | |
if [ -z "$base_dir" ] ; then | |
echo 'please location docker registry store location!'; | |
exit; | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# a script for replace base image | |
# using "docker history --no-trunc base-image-tag " to found the right base base-image-id | |
if [ -z "$1" -o -z "$2" -o -z "$3" ] ; then | |
echo 'usage:' | |
echo ' replace supper image id:' | |
echo ' 1. using "docker history --no-trunc base-image-tag " to found the right base image id need to be replaced' | |
echo ' 2. docker-replace-base-image.sh registry-store-location sub-image-tag base-image-id super-base-image-id ' | |
echo ' or if sub-image-parent-id need replaced with base-image-id:' | |
echo ' docker-replace-base-image.sh registry-store-location sub-image-tag base-image-tag ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# a script for merge one image dir to another | |
if [ -z "$1" -o -z "$2" -o -z "$3" ] ; then | |
echo 'usage:' | |
echo ' docker-merge-image-dir merge-into-image-tag old-image-tag old-image-dir [in-container-cmd,out-container-cmd]' | |
echo ' after merge old-image-tag = merge-into-image-tag + old-image-dir ' | |
exit | |
fi | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# a shell script for enter a container (using nsenter) | |
bin=$(which nsenter) | |
if [ -z "$bin" ] ; then | |
echo "please get nsenter using ( docker run --rm -v /usr/local/bin:/target jpetazzo/nsenter ) \n from https://github.com/jpetazzo/nsenter " | |
exit 1 | |
fi | |
c=""; | |
if [ -z "$1" ] ; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ips=$(host -t any a.sni.fastly.net | awk '{print $4}' | egrep '^[0-9]') ; echo $ips; ipList="";ipCount=0;okCount=0; for ip in $ips ; do echo "checking $ip ..."; ipCount=$[ipCount+1];p='archy';s=$(curl -k https://$ip/$p -H host:registry.npmjs.org --connect-timeout 1 -m 3 -s -H accept:application/json | jq '._id') ; echo " result:$s"; if [ "$s" = "\"$p\"" ] ; then ipList="$ipList $ip";okCount=$[okCount+1]; echo "$ip is ok"; else echo "$ip is not ok:("; fi ; done ; echo " $ipCount ok ip list $okCount: $ipList" ; echo "====>"; echo "copy one of below lines to hosts:"; for ip in $ipList; do echo "$ip registry.npmjs.org" ; done |