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.

19 lines
578 B

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