Last active
April 14, 2017 03:17
-
-
Save shanelau/06688e61259f12a0d20d18bb07f85e82 to your computer and use it in GitHub Desktop.
install docker on linux
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
dir=`dirname $0` | |
DOCKER_VERSION=1.13.1 | |
COMPOSE_VERSION=1.10.0 | |
function get_docker { | |
ensuredir $1 | |
DOCKER_COMPOSE_VERSION="DOCKER:$DOCKER_VERSION COMPOSE:$COMPOSE_VERSION" | |
if [ -e $1/version ] && [ "`cat $1/version`" = "$DOCKER_COMPOSE_VERSION" ]; then | |
echo docker has already fetched | |
return 0 | |
fi | |
DOCKER_LINK=https://get.daocloud.io/docker/builds/Linux/x86_64/docker-$DOCKER_VERSION.tgz | |
COMPOSE_LINK=https://get.daocloud.io/docker/compose/releases/download/$COMPOSE_VERSION/docker-compose-Linux-x86_64 | |
curl -L $DOCKER_LINK | tar xzC $1 | |
curl -L $COMPOSE_LINK > $1/docker/docker-compose | |
chmod +x $1/docker/docker-compose | |
echo $DOCKER_COMPOSE_VERSION > $1/version | |
} | |
get_docker docker_install_dir | |
# copy bin | |
dir=`dirname $0` | |
cp $dir/../docker/docker/* /usr/bin | |
cp $dir/../docker/init/sysvinit-redhat/docker /etc/init.d/ | |
groupadd docker | |
gpasswd -a root docker | |
systemctl daemon-reload | |
systemctl start docker | |
systemctl enable docker | |
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
dir=`dirname $0` | |
USER_COUNT=5 | |
USE_EXPIRE=`date -d "+60 days" +%s000` | |
if [ -z "$1" ]; then | |
echo no dir | |
exit 1 | |
fi; | |
root_dir=$1/compose | |
if [ ! -d $root_dir ]; then | |
mkdir -p $root_dir | |
fi | |
img=`cat $dir/../versions | awk '{print "export IMG_"toupper($1)"="$1":"$3}'` | |
config=`cat $dir/../compose/config` | |
templ=`cat $dir/../compose/docker-compose.template.yaml` | |
printf "$config\n$img\ncat << EOF\n$templ\nEOF" | bash > $root_dir/docker-compose.yaml | |
license=`cat $dir/../versions | grep "^license " | awk '{print $1":"$3}'` | |
web=`cat $dir/../versions | grep "^web " | awk '{print $1":"$3}'` | |
docker run --env USER_COUNT=$USER_COUNT --env USE_EXPIRE=$USE_EXPIRE $license > $root_dir/LICENSE | |
#docker-compose -f $root_dir/docker-compose.yaml up -d | |
# | |
#docker-compose -f $root_dir/docker-compose.yaml exec web node /web/src/upgrade/init.js | |
# | |
#docker-compose -f $root_dir/docker-compose.yaml exec web node /web/src/upgrade/upgrade 2.15 2.15 | |
#docker-compose -f $root_dir/docker-compose.yaml exec logparser ./initdb.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment