install 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env sh
  2. set -e
  3. check()
  4. {
  5. yes=`which $1 | wc -l`
  6. echo $yes
  7. }
  8. status=`check docker`
  9. if [ "$status" = 0 ]; then
  10. apt-get update
  11. apt-get -y install apt-transport-https ca-certificates curl software-properties-common
  12. curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
  13. add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
  14. apt-get -y update
  15. apt-get -y install docker-ce
  16. fi
  17. mkdir -p /etc/docker
  18. tee /etc/docker/daemon.json <<-'EOF'
  19. {
  20. "registry-mirrors": ["https://vwypw7yj.mirror.aliyuncs.com"]
  21. ,"insecure-registries" : ["docker.dever.cc"]
  22. }
  23. EOF
  24. service docker restart
  25. chmod -R +x src/*.py
  26. chmod -R +x src/shell
  27. chmod -R 777 container/share/
  28. basepath=$(cd `dirname $0`; pwd)
  29. ln -sf $basepath/src/dm.py /usr/bin/dm && chmod +x /usr/bin/dm
  30. ln -sf $basepath/src/dp.py /usr/bin/dp && chmod +x /usr/bin/dp
  31. ln -sf $basepath/src/dpc.py /usr/bin/dpc && chmod +x /usr/bin/dpc
  32. ln -sf $basepath/src/dever.py /usr/bin/dever && chmod +x /usr/bin/dever
  33. ln -sf $basepath/src/dgit.py /usr/bin/dgit && chmod +x /usr/bin/dgit
  34. docker version
  35. echo 'install success!'