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.

17 lines
577 B

  1. #!/bin/bash
  2. if ! type -p docker; then
  3. echo "Installing docker..."
  4. curl -sSL https://get.docker.io | sh
  5. fi
  6. version="$(apt-cache madison docker-ce | cut -f 2 -d \| | grep 17.06 | head -n 1 | xargs echo)"
  7. ## DOWNGRADE to 17.xx because 18.xx do not support registry v1
  8. apt-get install -y --force-yes docker-ce="$version"
  9. if ! egrep 'disable-legacy-registry' /lib/systemd/system/docker.service 2>/dev/null; then
  10. sed -ri 's/^(ExecStart=.*)$/\1 --disable-legacy-registry=false/g' /lib/systemd/system/docker.service
  11. fi
  12. systemctl daemon-reload &&
  13. service docker restart