Linux

Install Docker CE, Docker Compose, Portainer and, Nginx Proxy Manager on Debian 12

Server Options

You can use anything you like so long as it supports Docker and Portainer. At home I use Proxmox (tutorial on that coming soon) and online I use Digital Ocean… in both instances I use Debian and highly recommend it over everything else.

Why Debian?

Well, it’s the most stable server OS I’ve ever used and it’s 100% powered by the community. So, we don’t have to worry about how Red Hat shenanigans, for instance. Those shenanigans effected Fedora to a small extent. You can argue that Canonical’s shenanigans could effect Debian, but you’d be wrong. Fedora is based upon Red Hat, so it can be effected. However, Ubuntu is based on Debian. So, it’s the other way around. In this case, the community is maintaining the OG and the corporation is using that to create their version. So, Debian is both safe from this nonsense and as stable as a house made out of stable things.

Honestly, Ubuntu server is popular and works well… in fact, most of the tutorials are geared toward Ubuntu. Most of these online tutorials will work on Debian (sometimes with minor changes) as well but this tutorial is 100% for Debian.

Debian is more barebones, so you may need to install ssh and a few other basic things to make it work. When you’re on shared hosting, many of those things come as a pre-installed package. However, if you type a command and get an error that is like, “wtf is this apt thing?” You’ll need to install Apt. This would be really weird, because it usually comes with Debian, but let’s show you how to do this. I’m not going to walk through every possible issue… because most of it can be solved with a quick google, but let’s pretend Apt isn’t installed (teach a person to fish and all that).

sudo apt update
sudo: apt: command not found

This is what when happen when you try to run any apt command.

sudo dpkg --configure -a
sudo apt-get install --reinstall apt

Why Digital Ocean

I’m using a Digital Ocean Droplet, which is a VM. I’ve been using them for years for all my websites, including this one. It’s running on a fast premium AMD droplet that’s only costing $7 a month. You can use my link and get $200 free to test it out for 60 days:
m.do.co/c/72453d4e8a04

If you use that link, you can spin up a bunch of servers and test things. This is what I recommend doing.

There are other options, like Linode and such. I’ve used most of them, but I find Digital Ocean to be faster and offer more for the money. Plus, their systems and interface are very easy to use.

Let’s Install Docker CE First

Install Dependencies

apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

Now, we have to add the Docker repository to Debian. This is a big chunk of stuff, but you just copy it all in one go:

curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null

Next we are going to do an apt-update to make sure it’s ready to go:

apt-get update -y
apt-get install docker-ce docker-ce-cli containerd.io -y

You can check to see if that worked simply by typing: Docker Version

Let’s Install Docker Compose

Docker Compose is as fancy as it is annoying. Luckily, it’s a lot easier to deal with inside Portainer. So let’s get it installed so we can get on to Portainer.

Download it:

wget https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-linux-x86_64

Now, let’s copy the binary to the system path:

cp docker-compose-linux-x86_64 /usr/local/bin/docker-compose

Deal with permissions:

chmod +x /usr/local/bin/docker-compose

That’s it. You can check it out by typing: docker-compose –version. This will show you if it’s installed or not.

Let’s Install Portainer

Now, here’s the easy part that will also make things easier.

docs.portainer.io/start/install-ce/server/docker/linux

You can always use the link above to check Portainer’s documentation to make sure things are up to date.

First we need to create a volume for Portainer Server’s database to live in.

docker volume create portainer_data

Next, we download Portainer and install it with this one command:

docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

That’s it! We’re in. It’s time to log into the web interface. So, open up for favorite browser that isn’t Chrome and head to:

https://your-server-ip:9443

Nginx Proxy Manager default login email and password:

Email:    [email protected]
Password: changeme

Portainer template lists

Portainer allows you to install docker apps through various templates that they or others have created. The default template list is a bit sparse, so I like go to the settings and swap the default URL out for this one:

https://raw.githubusercontent.com/ntv-one/portainer/main/template.json

You don’t have to use that list. There are plenty to choose from. Someone on reddit combined a bunch of template lists. I generally prefer the one linked above, since there are more web apps that I like to use, but you’re welcome to try several. You can also change the template list any time. Anyway, here’s that list from reddit (note, there are duplicates on this list):

https://raw.githubusercontent.com/Qballjos/portainer_templates/master/Template/template.json

If you’re looking for more ideas on what you can do with Portainer, check out big-bears how-to files. Just look for any that end in “portainer.”
github.com/bigbeartechworld/big-bear-video-assets/tree/main

You may need a swap file… so let’s make one that’s 2G:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile

That should be enough to get you going for now. Feel free to post questions. The video will cover Nginx Proxy Manager’s setup through Portainer.

Logan

I like heavy metal and video games. Hardware is ok too, I guess. Twitter: https://twitter.com/Logan_RTW https://keepitmetal.com
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button