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.

25 lines
803 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.06
  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 ! egrep 'disable-legacy-registry' /lib/systemd/system/docker.service 2>/dev/null; then
  15. sed -ri 's/^(ExecStart=.*)$/\1 --disable-legacy-registry=false/g' /lib/systemd/system/docker.service
  16. need_restart=true
  17. fi
  18. if [ "$need_restart" ]; then
  19. systemctl daemon-reload &&
  20. service docker restart
  21. fi