Problems activating your account? Send notification email to:
Host4Fun Budget VPS Hosting
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Installing Docker & Portainer on Debian 10
Installing Docker & Portainer on Debian 10

Hello Post4VPS Community

A few days ago I was talking with a few work colleagues from the IT department in which I work as a full time staff at my current employer. We were talking about Docker and that we're looking forward to use it more and replace all our standalone Linux servers and applications with Docker containers to reduce work and maintenance load caused by them. We run a monitoring system, a ticket system and a UniFi controller on seperate physical and virtual Linux servers with different Debian OS versions (8 which is EOL soon if it isn't already and 9). Every of these services requires a web server, PHP (or Redis/Ruby) and a database engine. So you can image how much work it is to install all of this for each of the servers, install the individual applications and maintain everything over all the years. The company I work for is mid sized but we have several branches in addition to our main HQ. The IT department is basically too small to manage the amount of people and systems that we have. We have taken steps forward to fix this issue already by hosting some important servers off site through a IT contractor and we're looking forward to hire new staff.

Anyway. TL;DR: we want to port all our dedicated Linux machines into Docker containers to reduce workload and maintenance on them. As I mentioned before we already use Docker and want to use it more often. The problem with this is that "we" currently is one staff who is very into Docker and has set everything up with a full dedicated server and a powerful VM as a Docker Swarm (although Docker Swarm is history now with the purchase by Kubernetes). What does that mean? Well, one simple and important thing: we need at least a second Docker administrator to jump in for cases where stuff goes wrong or to create new projects in Docker and maintain them. Guess who that is. Right, it is me. My problem: aside from reading things about Docker and always wanting to try it out I never did and never had the chance due to way too much work.

How is that story related to this tutorial? I have a VPS 16 with 12 GB of RAM and 200 GB of storage space. I have projects I want to run that would actually also require many different components to be installed separately if done without Docker. And that is the point where my job meets my hobby. I want to learn how to use Docker and Portainer (we use this to manager our Docker containers) and use this knowledge to run the projects I wanted to host on my VPS 16. Through this and maybe other tutorials I want to share my journey and experience with you.

Let's get ready.

  • A dedicated or virtual server with Debian 10 64 Bit. If it is a VM/VPS I would recommend KVM, Hyper-V, VMWare or other hardware virtualization.
  • The server should be compatible with Docker without limitations created by virtualization like OpenVZ or others.
  • Root or administrative access (sudo) on your server and basic Linux experience to manage the server.

Other than that you simply need time and fun with learning and hosting new things. Docker and similar container technologies are becoming the future of hosting and cloud hosting because they're easy to use and maintain after you've learned how to handle it all. There are a lot of helpful tools such as Portainer, Traefik and others.

Now to the guide.

Step 1

First of all login into your server as root or as a user that has administrative access. After you're in it's time to update the server to the latest package versions and state. Run the command below to update Debian 10 to the latest version.

Update commands:
apt-get update
apt-get upgrade -y
apt-get dist-upgrade -y
(Remember to use sudo infront of the commands if you're not root).

After you're done with updating I would recommend to reboot the server once to make sure all updates are applied properly. Once the server is back we can install everything needed to get the latest version of Docker for Debian 10.

First install a few important tools to which will allow apt to download packages over HTTPS by using the command below.
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y

Now download and import the repo key of the official Docker repo for Debian by using the commands below.
curl -fsSL | apt-key add -

After that is done we can add the repo to the Debian package sources with the following commands.
add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

Now update the local package database on your server with the command below.
apt-get update

Step 2

At this point we can install Docker on the server by using the commands below.
apt-get install docker-ce -y

The installation process will take a while. Just wait until you are at the terminal again and can enter further commands.

Check if the Docker services are running with the command below.
systemctl status docker

If it isn't running start it with the following command.
systemctl start docker

If it isn't starting due to some kind of issue or error feel free to open a support thread here or consult Google and other sites. Most important read the Docker documentation, too!

Docker is now installed on the server.

Step 3

Finally we can install Portainer to manage our Docker containers. Actually Portainer is already a Docker container that manages all the other Docker containers we want to run. So we're already installing our first container!

To install Portainer on your server run the commands below.
docker volume create portainer_data
docker run -d -p 9000:9000 -p 8000:8000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

This two commands will create a volume for Portainer where all the configurations and other files are stored for it and then it will create a Portainer Docker container. After running this commands you can access Portainer on port 9000 already. Just open it in your web browser by going to IP:9000 oder domain:9000. There you can do the first configuration such as setting up a password and a administrator username.

This is how Portainer looks like after you login the first time:
[Image: MOnYR9q.png]

We're at the point where we have Docker and Portainer running already. Data is stored in the volume that was created before. The volume is located in /var/lib/docker/volumes/. You can find out the location by running the following command.
docker volume inspect portainer_data

Result would be like this:
        "CreatedAt": "2019-12-13T13:15:01-05:00",
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/portainer_data/_data",
        "Name": "portainer_data",
        "Options": {},
        "Scope": "local"

Now that Portainer is installed you can start using it. I would recommend to use its documentation to get started. This guide is purely for the installation of it as I haven't started using it actively, yet. I wanted to install Docker and Portainer to have something to begin with.

Docker documentation:
Portainer documentation:

I hope you can make use of this guide. I'm about to start learning how to use Docker with their official documentation and the same for Portainer.

This guide was infact created by reading both documentations and applying them on my own server successfully.

Possibly Related Threads...
Thread Author Replies Views Last Post
  Easy way to upgrade Debian 9 to Debian 10 Hidden Refuge 6 278 2 hours ago
Last Post: LightDestory
  How to install Bright Game Panel in Debian Dynamo 48 31,062 11-14-2019, 04:03 AM
Last Post: Dynamo
  Installing WordPress on CentOS 7 Manal 0 257 09-06-2019, 07:02 PM
Last Post: Manal
  Setting Up MyBB Forum On a Linux Server ( Ubuntu / Debian ) Rehan 4 397 09-03-2019, 12:55 PM
Last Post: sohamb03
  Migrate Your Website to New VPS Host ( Ubuntu/Debian ) Rehan 9 688 08-24-2019, 11:50 AM
Last Post: Melvin

Forum Jump:

Users browsing this thread: 1 Guest(s)

Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - SSDBlaze - Abc-Hosters - Hyper Expert - Shadow Hosting - Bladenode - Hostlease

About Post4VPS

Post4VPS is a forum/destiny where you can Delploy Your Free VPSs just by the Power of Posts.

We Provide VPSs of many locations like Germany,US,Canada,France,London,etc.

We also Provide VPSs of Both Linux and Windows OS.