vp-02-add-docker.sh 835 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. if (( $EUID != 0 )); then
  3. echo "Eseguire lo script come amministratore"
  4. exit
  5. fi
  6. # installo dipendenze
  7. apt install --yes lsb-release gnupg2 apt-transport-https ca-certificates curl software-properties-common
  8. # scarico chiave GPG e la installo
  9. curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/debian.gpg
  10. # aggiungo il repository
  11. sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
  12. # aggiorno apt
  13. sudo apt update
  14. # installo docker
  15. sudo apt install --yes docker-ce docker-ce-cli containerd.io docker-compose-plugin
  16. # aggiungo utente corrente al gruppo docker
  17. usermod -aG docker $USER
  18. # abilito servizio
  19. systemctl enable docker
  20. # faccio partire il servizio
  21. systemctl start docker