Code Monkey home page Code Monkey logo

dockerinstall's Introduction

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')
  • set -o errexit: The script will exit if any command exits with a non-zero status.
  • set -o nounset: The script will exit if it tries to use an uninitialized variable.
  • IFS=$(printf '\n\t'): Internal Field Separator is set to newline and tab.
  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'
  • Installs sudo and curl using the apt package manager.
  • Downloads the Docker installation script using curl.
  • Executes the Docker installation script using sudo sh.
  • Prints a success message.
  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.
  1. 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
  • Retrieves the latest Docker Compose version from GitHub API.
  • Downloads Docker Compose binary using curl and installs it in /usr/local/bin/.
  • Sets executable permissions for Docker Compose.
  • Downloads Bash completion script for Docker Compose.
  • Prints a success message.
  • Displays the installed Docker Compose version.

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.

dockerinstall's People

Contributors

dnburgess avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.