dnburgess / dockerinstall

Just a quick and easy way to deploy Docker and Docker Compose with just a couple of commands
73 stars 37 forks source link
docker docker-compose install-docker install-docker-compose

DB Tech's Docker and Docker Compose Install

Install Using Root (Non-Root method below)

To install the newest versions of sudo (optional depending on which script you use), curl, Docker, and docker compose, simply ssh into your server, then clone this repository with:

git clone https://github.com/dnburgess/dockerinstall.git

If you don't have git installed, you can run:

apt install git

Change into the new directory:

cd dockerinstall

Make the file executable:

chmod +x dockerinstall.sh

Execute the file:

./dockerinstall.sh

Install Without Using Root

If you don't want to use root/sudo, you can do the following:

Clone the repository:

git clone https://github.com/dnburgess/dockerinstall.git

If you don't have git installed, you can run:

apt install git

Change into the new directory:

cd dockerinstall

Make the file executable:

chmod +x dockerinstallnoroot.sh

Execute the file:

./dockerinstallnoroot.sh

Install Using Root (includes Portainer)

To install the newest versions of sudo (optional depending on which script you use), curl, Docker, and docker compose, simply ssh into your server, then clone this repository with:

git clone https://github.com/dnburgess/dockerinstall.git

If you don't have git installed, you can run:

apt install git

Change into the new directory:

cd dockerinstall

Make the file executable:

chmod +x dockerportainerinstall.sh

Execute the file:

./dockerportainerinstall.sh

The Bash Script Explained

This shell script appears to automate the installation of Docker and Docker Compose on a Linux system. Here's a breakdown of what each section of the script does:

  1. Set Script Options:
set -o errexit
set -o nounset
IFS=$(printf '\n\t')
  1. Install Docker
    apt install sudo -y && apt install curl -y
    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    printf '\nDocker installed successfully\n\n'
  1. Wait for Docker to Start

    printf 'Waiting for Docker to start...\n\n'
    sleep 5
    • Prints a message indicating that the script is waiting for Docker to start.
    • Sleeps for 5 seconds.
  2. Install Docker Compose:

    COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)
    sudo curl -L https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
    sudo chmod +x /usr/local/bin/docker-compose
    sudo curl -L https://raw.githubusercontent.com/docker/compose/${COMPOSE_VERSION}/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose
    printf '\nDocker Compose installed successfully\n\n'
    sudo docker-compose -v

Please note that this script assumes a Debian-based Linux distribution. If you are using a different distribution, adjustments may be needed. Additionally, it's essential to review and understand scripts before executing them, especially when using sudo commands from the internet.