fork 0k-charms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
652 B

  1. #!/bin/bash
  2. need_restart=
  3. if ! type -p docker; then
  4. echo "Installing docker..."
  5. type -p curl >dev/null ||
  6. apt-get install -y curl </dev/null
  7. curl -sSL https://get.docker.io | sh
  8. fi
  9. docker_version=17
  10. if ! [[ "$(docker --version)" == "Docker version $docker_version"* ]]; then
  11. version="$(apt-cache madison docker-ce | cut -f 2 -d \| | grep "$docker_version" | head -n 1 | xargs echo)"
  12. ## DOWNGRADE to 17.xx because 18.xx do not support registry v1
  13. apt-get install -y --force-yes docker-ce="$version"
  14. need_restart=true
  15. fi
  16. if [ "$need_restart" ]; then
  17. systemctl daemon-reload &&
  18. service docker restart
  19. fi