My personal Newbie Sunday: How to install docker on Debian.

Hello all !

Following that post, I’m offering to noobs like me the opportunity to learn how to install docker to a Debian system. Being a beginner myself, I don’t pretend to know the perfect or more appropriate way to achieve this, and I hope that more experienced people will join the conversation to correct and complete the informations I’m about to give.

The first way I know of is the way I first installed docker and portainer on my machine. I used OpenMediaVault and omv-extras, which was quite straight formard. But depending on the version you are using, you might not find omv-extras anymore in OMV, and the new way of getting docker through it is in my opinion quite painfull.

So let’s go with the simple way:

Pre-requisite : having Debian installed on your machine and SSH into it.

Set up the repository:

  1. Update the apt package index and install packages to allow apt to use a repository over HTTPS:
<pre style="background-color:#ffffff;">
<span style="color:#323232;">sudo apt-get update
</span><span style="color:#323232;">sudo apt-get install 
</span><span style="color:#323232;">    ca-certificates 
</span><span style="color:#323232;">    curl 
</span><span style="color:#323232;">    gnupg 
</span><span style="color:#323232;">    lsb-release
</span>
  1. Add Docker’s official GPG key:
<pre style="background-color:#ffffff;">
<span style="color:#323232;">sudo mkdir -p /etc/apt/keyrings
</span><span style="color:#323232;">curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
</span>
  1. Use the following command to set up the repository:
<pre style="background-color:#ffffff;">
<span style="color:#323232;">echo 
</span><span style="color:#323232;">  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian 
</span><span style="color:#323232;">  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
</span>

Install Docker Engine

  1. Update the apt package index:
<pre style="background-color:#ffffff;">
<span style="color:#323232;">sudo apt-get update
</span>
  1. Install Docker Engine, containerd, and Docker Compose:
<pre style="background-color:#ffffff;">
<span style="color:#323232;">sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
</span>
  1. You can verify that Docker Engine is installed correctly by running the hello-world image.
<pre style="background-color:#ffffff;">
<span style="color:#323232;">sudo docker run hello-world
</span>

Install Portainer

  1. Create Docker Volume to store the data:
<pre style="background-color:#ffffff;">
<span style="color:#323232;">docker volume create portainer_data
</span>
  1. Install Portainer Server:
<pre style="background-color:#ffffff;">
<span style="color:#323232;">docker run -d -p 8000:8000 -p 9000:9000 --name portainer 
</span><span style="color:#323232;">--restart=always 
</span><span style="color:#323232;">-v /var/run/docker.sock:/var/run/docker.sock 
</span><span style="color:#323232;">-v portainer_data:/data 
</span><span style="color:#323232;">portainer/portainer-ce:latest
</span>

Access Portainer Dashboard

  1. In a browser, visit the following address:
<pre style="background-color:#ffffff;">
<span style="color:#323232;">http://<yourmachineipadress>:9000
</span>
  1. The first time you access Portainer, the system asks to create a password for the admin user. Type the password twice and select the Create user button.
  2. Select the Get Started button to go to the dashboard and start using Portainer in the local environment only.

You’re set up ! Now, you can use simple docker-composes in Portainer stacks tab to deploy new apps and services.

snekerpimp,

Docker has an install script on their https://github.com/docker/docker-install page that takes a lot of the headache out. Also ‘sudo usermod -aG docker $USER’ will allow you to run docker without sudo.

Tiritibambix,
@Tiritibambix@lemmy.ml avatar

Great tips. Thank you.

Ferawyn,

I would suggest having a look at podman. It’s a drop-in replacement for docker, except it doesn’t require a constantly running daemon, it comes in the main package repositories, so you don’t have to do the key and repository stuff, and cockpit has a plugin to help manage podman containers.

Tiritibambix,
@Tiritibambix@lemmy.ml avatar

Will have a look. Thanks for the suggestion.

Makan,

Debian system?

Tiritibambix,
@Tiritibambix@lemmy.ml avatar

Yes, as stated in the title and post. It is stable and easy to use and update. It also is available on a wide variety of architectures and devices. So far it never failed me.

I believe my post could apply to other systems.

If that was a rethorical question, I believe you’re not in favor of it. I think it would be more constrictive to elaborate and participate to the conversation:)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • selfhosted@lemmy.world
  • DreamBathrooms
  • magazineikmin
  • InstantRegret
  • hgfsjryuu7
  • vwfavf
  • Youngstown
  • slotface
  • thenastyranch
  • ngwrru68w68
  • rosin
  • kavyap
  • PowerRangers
  • Durango
  • khanakhh
  • anitta
  • mdbf
  • tacticalgear
  • ethstaker
  • modclub
  • osvaldo12
  • everett
  • tester
  • cubers
  • GTA5RPClips
  • normalnudes
  • Leos
  • cisconetworking
  • provamag3
  • All magazines