Skip to content

Instantly share code, notes, and snippets.

@DanilAndreev
Last active April 28, 2021 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanilAndreev/0dc213fb739844a054e3784d8378e248 to your computer and use it in GitHub Desktop.
Save DanilAndreev/0dc213fb739844a054e3784d8378e248 to your computer and use it in GitHub Desktop.
Docker setup bash script

Linux docker install script

Overview

This script will automatically install docker and docker-compose and configure them for use without command sudo.

Usage

  1. Copy setup.sh to your OS in any available way.
  2. Move to this script directory:
    cd /path/to/direcotry
  3. Run the script:
    sudo bash setup.sh

Credits

Author: Danil Andreev

#!/bin/sh
# Installing docker
# Updating apt-get registry
sudo apt update
# Installing service packages
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
# Setting repository
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
# Updating apt-get registry
sudo apt update
# Installing docker-ce
sudo apt install -y docker-ce
# Adding rights to use docker command without sudo
sudo groupadd docker
sudo gpasswd -a $USER docker
sudo service docker restart
# Installing docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
echo "Done. Happy hacking"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment