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

3 years ago by Tiritibambix to c/selfhosted

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:
sudo apt-get update
sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
  1. Add Docker’s official GPG key:
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
  1. Use the following command to set up the repository:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker Engine

  1. Update the apt package index:
sudo apt-get update
  1. Install Docker Engine, containerd, and Docker Compose:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
  1. You can verify that Docker Engine is installed correctly by running the hello-world image.
sudo docker run hello-world

Install Portainer

  1. Create Docker Volume to store the data:
docker volume create portainer_data
  1. Install Portainer Server:
docker run -d -p 8000:8000 -p 9000:9000 --name portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:latest

Access Portainer Dashboard

  1. In a browser, visit the following address:
http://<yourmachineipadress>:9000
  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.

load all comments
Ferawyn 5 points 3 years ago

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.

path: 0 523495, hotness: undefined, score: 5, children: 1
Tiritibambix 2 points 3 years ago

Will have a look. Thanks for the suggestion.

path: 0 523495 528556, hotness: undefined, score: 2, children: 0
selfhosted
selfhosted

@lemmy.world

login for more options
62987
6805
5747

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details. Tags [CBH] or [AIP] are required, see the links in Rule 8 for details.

  8. AI-related discussions and AI-involved promotional posts have additional requirements for tagging, as noted in Rule 7 and the AI & Promotional Post Expanded Rules post, and find example disclosures here.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

go to feed...