install 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
  11. apt-get update
  12. apt-get -y install apt-transport-https ca-certificates curl software-properties-common
  13. curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
  14. add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
  15. apt-get -y update
  16. apt-get -y install docker-ce
  17. fi
  18. mkdir -p /etc/docker
  19. tee /etc/docker/daemon.json <<-'EOF'
  20. {
  21. "registry-mirrors": ["https://vwypw7yj.mirror.aliyuncs.com"]
  22. ,"insecure-registries" : ["docker.dever.cc"]
  23. }
  24. EOF
  25. service docker restart
  26. chmod -R +x src/*.py
  27. chmod -R +x src/shell
  28. chmod -R 777 container/share/
  29. basepath=$(cd `dirname $0`; pwd)
  30. ln -sf $basepath/src/dm.py /usr/bin/dm && chmod +x /usr/bin/dm
  31. ln -sf $basepath/src/dp.py /usr/bin/dp && chmod +x /usr/bin/dp
  32. ln -sf $basepath/src/dpc.py /usr/bin/dpc && chmod +x /usr/bin/dpc
  33. ln -sf $basepath/src/dever.py /usr/bin/dever && chmod +x /usr/bin/dever
  34. ln -sf $basepath/src/dgit.py /usr/bin/dgit && chmod +x /usr/bin/dgit
  35. docker version
  36. echo 'install success!'