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 docker-compose

# Show from which repository DOCKER will be installed
echo "--- We are goint to install DOCKER from below repo ---
apt-cache policy docker-ce

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 *