Created
          November 22, 2019 13:08 
        
      - 
      
 - 
        
Save David-Lor/4be07ea780f09229c812143de5301f02 to your computer and use it in GitHub Desktop.  
    Install Docker on Debian 10
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| if [[ ! $UID -eq 0 ]] | |
| then | |
| echo "Must run as root!" | |
| exit 1 | |
| fi | |
| fingerprintNotMatch() { | |
| echo 'WARNING, Fingerprint NOT MATCH, exiting!' | |
| exit | |
| } | |
| set -ex | |
| apt update | |
| apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common | |
| # get key | |
| curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - | |
| # verify fingerprint (https://docs.docker.com/v17.12/install/linux/docker-ce/debian/#set-up-the-repository) | |
| echo $(apt-key fingerprint 0EBFCD88) | grep -q '9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88' && echo 'Fingerprint match!' || fingerprintNotMatch | |
| # add docker repository | |
| add-apt-repository \ | |
| "deb [arch=amd64] https://download.docker.com/linux/debian \ | |
| $(lsb_release -cs) \ | |
| stable" | |
| # install docker | |
| apt update | |
| apt install -y docker-ce docker-compose | |
| # verify docker is installed | |
| docker run --rm hello-world | |
| docker image rm hello-world | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment