Mastodon Skip to main content

Install Docker, Docker-Compose, and more in Under 5 Minutes

For a couple of years now, I've been showing you all how to install and use some amazing open source software.  The vast majority of that software is, or can be, run in Docker, and many times we use Docker-Compose and NGinX Proxy Manager to run these applications and make them available from outside your network.

After doing this over, and over, and over again, i finally decided it was time to script it all.  I originally made several different scripts trying to cover several Linux distros / OSes, but have now combined these into a single script, that simply prompts you to choose your distro from one of the following:

  • CentOS 7
  • Debian 10
  • Ubuntu 18.04
  • Ubuntu 20.04

After choosing your distro, you are prompted to select each application you'd like to install as well, from:

  • Docker-CE (Community Edition)
  • Docker-Compose
  • NGinX Proxy Manager (setup with the defaults from the homepage Quick Setup)
  • Protainer-CE.

You simply give a "y" or "n" for each one to say "y"es I want it installed, or "n"o I don't.

Where can I use this script?

You can use this script on any server / machine you wish.  I don't have it setup to install all of this on Arm based systems (yet), but it should run on any ohter systems.  This is an open source script, used to install open source software. You can use it to install the applications on your homelab, or on a VPS like Digital Ocean, SSD Nodes, Linode, etc.

How to Run It

You first need to get the script onto your system. There are a few ways to do this.

  • Clone the repo
  • Click on the Script in your browser, highlight, copy, and paste.
  • Download the Script directly using wget.

Clone the Repository

To do this, you need to have git installed on your system.  You can check whether git is installed by running:

git --version

You should see something like this returned:

git version 2.30.2

If you don't, then you may need to install git in order to clone the repository.

To clone, you'll use the following git command:

git clone https://gitlab.com/bmcgonag/docker_installs.git

Once, clone, you can move into the new folder added to your system by doing:

cd docker_installs

from there, just follow the "Run the Script" section below.

Highlight, Copy, Paste

This is the most manual, but quite possibly the simplest method to get the script.

In the browser, click on the script link to display the script code. Once it's displayed, simply highlight the entire script starting at the beginning of line 1, all the way to the end of the last line.

Now, in your terminal use nano, vi, vim, or your favorite text editor, and create a new empty text file.

nano docker-install.sh

Now paste the copied script into the new empty file.  In the terminal, you can use the hotkey combination CTRL + Shift + V to paste, or you can right click, then select "paste" from the pop-up menu.  Save the file with CTRL + O, then Enter to confirm, and exit the text editor with CTRL + X. From there, just follow the "Run the Script" section below.

Download the script with wget

The third option to get the script is to use wget t0 download it dirctly.  In the terminal use the command:

wget https://gitlab.com/bmcgonag/docker_installs/-/raw/main/install_docker_nproxyman.sh

You need the wget application to do this, but generally wget is pre-installed on most distributions.  

This command will download the script directly to your current directory. From there, just follow the "Run the Script" section below.

Run the Script

Now that you have the script on the machine you want to run it on, you are ready to run it and install the applications you want / need.

First, let's make the script executable. Regardless of what the script is named, use the following command to make it executable:

chmod +x <script name> where <script name> is replaced with the actual file name of the script.

Now we can run the script with the command:

./<script name> where <script name> is replaced with the actual file name of the script.

The script will now run.  You'll be asked to select the number of your distro, then to answer "y" to any of the applications you want installed by the script.

If you are logged in as a sudo user (not root), then you'll be prompted for your sudo password as well.

I hope this script is helpful to you and your self-hosting needs.

Support my Channel and Content

Support my Channel and ongoing efforts through Patreon:
https://www.patreon.com/bePatron?u=234177