DEV Community

shiv
shiv

Posted on

DOCKER INSTALLATION SHELL SCRIPT

!/bin/bash

Checks whether docker installed or not:

   if [ ! -x /var/lib/docker ]; then

echo "INSTALLING docker"

Installing software dependencies:

     echo "Y" | apt install apt-transport-https ca-certificates curl software-properties-common

Adding the Docker key in repository:

     curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"

Updating the system:

    echo "Y" | apt update

Installing Docker:

    apt-cache policy docker-ce

    echo "Y" | sudo apt install docker-ce

     echo "docker successfully installed"

Shows message if docker already installed during initial check:

  else
   echo "DOCKER ALREADY INSTALLED"
   fi

Installation Shell Script for Docker Available in Github Repo

Top comments (0)