Install Docker on Debian 9

Here is a simple script to install docker on Debian 9

  1. Create the script text file with nano
sudo nano

2. Copy this code to the file and save it

# Run this script to install Docker on Debian 9

#Install prerequisites
sudo apt update
sudo apt --yes install apt-transport-https ca-certificates curl gnupg2 software-properties-common

# Add the GPG key for the official Docker repository to your system:
curl -fsSL | sudo apt-key add -

# Add the Docker repository:
sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

# Istall Docker
sudo apt update
sudo apt install -y docker-ce docker-ce-cli

#Install docker-compose
sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

echo "---------------- INSTALLATION FINISHED ---------------"

# Check docker status
sudo systemctl status docker

3. Make it executable:

chmod +x

4. Run the script

sudo ./

P.S. it might work on other systems aside fro Debian 9, but tested on Debian 9. This script is intended to simplify Docker setup in case I need it in the future.

Leave a Reply

Your email address will not be published. Required fields are marked *