DEV Community

loading...

DOCKER INSTALLATION SHELL SCRIPT

shiv
DevOps Engineer
・1 min read

!/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

Discussion (0)