Docker is a leading containerisation technology that is free and open-source, it allows you to run applications in isolation. Docker Compose and Portainer can be used together to provide a highly scalable and lightweight environment that can run a plethora of services. 

If you’re not using Docker right now, here are 3 reasons you should. 

  1. It’s easy to use
  2. More efficient when compared to VM’s 
  3. Easy to scale when needed 

Let’s dive in and find out how to install Docker, Docker Compose and Portainer on Debian 11 Bullseye. 

How To Install Docker in Debian 11

One of the first things to do is ensure the system is up to date. This can be done with the following command:

sudo apt update && sudo apt upgrade -y

To enable apt to use HTTPS packages, install the following prerequisites:

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

To access the official Docker repository you must add the GPG key:

sudo curl -LR https://download.docker.com/linux/debian/gpg -o /etc/apt/trusted.gpg.d/docker.gpg.asc

The APT sources list needs to be updated to include Docker repository:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"

Then you will need to update the package database with the new Docker packages:

sudo apt update

Please make sure that you are installing from the Docker repository rather than the default Debian repository:

apt-cache policy docker-ce

Despite the fact that Docker’s version number may vary, the output will be similar to this:

You can see that docker-ce has not been installed yet, but the repository for installing it is from the Docker repository in Debian 11 (Bullseye).

Then install Docker with the following command:

sudo apt install docker-ce -y

Now, Docker has been installed, the daemon has been started, and the process has been enabled to start at boot. Verify that Docker is running:

sudo systemctl status docker

How To Install Docker Compose in Debian 11

The first thing to do is update the system. Execute the following command:

sudo apt update && sudo apt upgrade -y

You can download the current stable version of Docker Compose by running the following command:

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

To make the binary executable, grant the following permissions:

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

In the event that the installation fails, you may have to create a symbolic link between ‘/usr/bin’ and any other folder, this can be done with the following command.

sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Now it’s time to test the installation, use the following command to confirm the output:

docker-compose --version

How to install the Newest Version of Portainer in Debian 11

Now that Docker and Docker Compose are installed, we can go ahead and install Portainer. Start by creating a Docker volume named portainer_data:

sudo docker volume create portainer_data

Use the command below to download the latest version of Portainer:

sudo docker pull portainer/portainer-ce:latest

You can now use the following docker-run command to deploy the latest version of Portainer:

sudo 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-ce:latest

How to Access Portainer

After installing Portainer, it will be running on port 9000. You can access this by using a web browser and navigating to http://(your.server.ip.address):9000
To find the IP address of your server, there are a few places you can look. You could use a network discovery tool like Fing, or look in your router to see the DHCP leases. The easiest way, is to simply use the Linux command line.
To find the IP address, simply enter the following command:

ip addr

As you can see from the image below, the IP address of this server is 172.16.80.40 and to access the web-GUI for Portainer, I would visit the following address = http://172.16.80.40:9000/

Configuring Portainer For The First Time

Portainer will ask you to create an initial administrator user when you visit it for the first time. The default user is ‘admin’ – simply create a password for the account.

Following this, you will be given the option of choosing the type of Docker environment you would like to manage. By selecting the ‘Local’ button, we are able to manage Docker hosts in our local environment.

Conclusion:

In this blog post, we’ve discussed how to install Docker, Docker Compose and Portainer on a Debian 11 Bullseye server. Now that Docker has been installed, you can begin using it. Take a look at our guide to installing Nextcloud on Docker with Redis.

If you want to learn more about all things Docker related including installation, configuration and management then please visit the Docker section of Apache-IoT.

Similar Posts