{"id":19864,"date":"2023-07-19T06:24:30","date_gmt":"2023-07-19T06:24:30","guid":{"rendered":"https:\/\/linuxways.net\/?p=19864"},"modified":"2024-02-14T05:12:09","modified_gmt":"2024-02-14T05:12:09","slug":"how-to-install-docker-on-debian-12","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/how-to-install-docker-on-debian-12\/","title":{"rendered":"How to Install Docker on Debian 12?"},"content":{"rendered":"<p><strong>Docker <\/strong>is a fundamental tool in the current software development era to deploy and manage applications. It is a containerization technique that helps users to package and run their necessary applications within an isolated environment i.e. containers. It can be used and run on various platforms, i.e. Windows, MacOS, and Linux distributions including Debian.<\/p>\n<p>This guide will illustrate all the possible approaches for Docker installation on the Debian 12 system.<\/p>\n<p><strong>Quick Outline<\/strong><\/p>\n<ul>\n<li><a href=\"#post-19864-_kh7x8ccdq16f\"><strong>How to Install Docker on Debian 12?<\/strong><\/a><\/li>\n<li><a href=\"#post-19864-_brhp5vhulo8n\"><strong>How to Manage Docker Service on Debian 12?<\/strong><\/a><\/li>\n<li><a href=\"#post-19864-_6zcc02eclioq\"><strong>How to Configure Docker as a Non-root User on Debian 12?<\/strong><\/a><\/li>\n<li><a href=\"#post-19864-_exc8r02grkid\"><strong>How to Remove Docker From Debian 12?<\/strong><\/a><\/li>\n<li><a href=\"#post-19864-_e46bzgpxucci\"><strong>Final Thoughts<\/strong><\/a><\/li>\n<\/ul>\n<h2><a id=\"post-19864-_kh7x8ccdq16f\"><\/a>How to Install Docker on Debian 12?<\/h2>\n<p>In the Debian 12 system, <strong>Docker <\/strong>can be installed from:<\/p>\n<ul>\n<li><a href=\"#post-19864-_nanrbs2vjmsf\"><strong>Default Debian Repository <\/strong><\/a><\/li>\n<li><a href=\"#post-19864-_g7mb16tf8sk5\"><strong>Official Docker Repository <\/strong><\/a><\/li>\n<li><a href=\"#post-19864-_f9uoadhfgj9h\"><strong>Deb Package File<\/strong><\/a><\/li>\n<li><a href=\"#post-19864-_5p0thbbd8rxz\"><strong>Snap Store<\/strong><\/a><\/li>\n<li><a href=\"#post-19864-_ara1opkrkwbs\"><strong>Docker Shell Script<\/strong><\/a><\/li>\n<\/ul>\n<h3><a id=\"post-19864-_nanrbs2vjmsf\"><\/a>Method 1: Install Docker on Debian 12 From Default Debian Repository<\/h3>\n<p>The default Debian repository contains a collection of software packages including <strong>Docker<\/strong>. It is the easiest <strong>Docker <\/strong>installation method but it provides the outdated version of <strong>Docker<\/strong>. Go through the given instructions to install <strong>Docker <\/strong>on your Debian 12 using this method.<\/p>\n<p><strong>Step 1: Update Debian System<\/strong><\/p>\n<p>Before installing <strong>Docker<\/strong>, make sure to update your system\u2019s packages using the given commands:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt update<br \/>\n<span class=\"kw2\">sudo<\/span> apt upgrade<\/div><\/div>\n<p>This will refresh the Debian\u2019s repository packages.<\/p>\n<p><strong>Step 2: Install Docker on Debian 12<\/strong><\/p>\n<p>Then, use the given command to install the <strong>Docker <\/strong>package i.e. \u201c<strong>docker.io<\/strong>\u201d from the official Debian repository:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> docker.io <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"408\" class=\"wp-image-24817\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-1-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-1-1.png 738w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-1-1-300x166.png 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><\/p>\n<p><strong>Step 3: Ensure Installation <\/strong><\/p>\n<p>To ensure that <strong>Docker <\/strong>has been installed on your Debian system, check its version:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">docker <span class=\"re5\">--version<\/span><\/div><\/div>\n<p>The output displays <strong>Docker\u2019s <\/strong>outdated version that is installed on the system:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"732\" height=\"115\" class=\"wp-image-24818\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-2-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-2-1.png 732w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-2-1-300x47.png 300w\" sizes=\"auto, (max-width: 732px) 100vw, 732px\" \/><\/p>\n<h3><a id=\"post-19864-_g7mb16tf8sk5\"><\/a>Method 2: Install Docker on Debian 12 From Official Docker Repository<\/h3>\n<p>If you want to install the most up-to-date (latest) version of <strong>Docker<\/strong>, you can install it from the official <strong>Docker <\/strong>repository. This method provides the latest <strong>Docker <\/strong>packages with the newest updates and features. Moreover, it also automatically fetches and installs <strong>Docker\u2019s <\/strong>latest version via the package manager whenever it is available from the official repository.<\/p>\n<p>Here are the steps to install <strong>Docker <\/strong>on your Debian 12 system from the official <strong>Docker <\/strong>repository:<\/p>\n<p><strong>Step 1: Install Required Dependencies<\/strong><\/p>\n<p>First, install the following necessary dependencies for the installation of <strong>Docker <\/strong>on the Debian 12 system:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> gnupg apt-transport-https ca-certificates curl<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"754\" height=\"405\" class=\"wp-image-24820\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-3-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-3-1.png 754w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-3-1-300x161.png 300w\" sizes=\"auto, (max-width: 754px) 100vw, 754px\" \/><\/p>\n<p><strong>Step 2: Import Docker GPG Key<\/strong><\/p>\n<p>Next, utilize the provided command and import the <strong>Docker <\/strong>GPG key to ensure the reliability of<strong> Docker <\/strong>packages:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">curl <span class=\"re5\">-fsSL<\/span> https:<span class=\"sy0\">\/\/<\/span>download.docker.com<span class=\"sy0\">\/<\/span>linux<span class=\"sy0\">\/<\/span>debian<span class=\"sy0\">\/<\/span>gpg <span class=\"sy0\">|<\/span> <span class=\"kw2\">sudo<\/span> gpg <span class=\"re5\">--dearmor<\/span> <span class=\"re5\">-o<\/span> <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>share<span class=\"sy0\">\/<\/span>keyrings<span class=\"sy0\">\/<\/span>docker.gpg<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"755\" height=\"115\" class=\"wp-image-24821\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-4-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-4-1.png 755w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-4-1-300x46.png 300w\" sizes=\"auto, (max-width: 755px) 100vw, 755px\" \/><\/p>\n<p><strong>Step 3: Add Docker Repository to Debian 12<\/strong><\/p>\n<p>Then, add\/import the <strong>Docker\u2019s <\/strong>official repository to the Debian 12 system:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">echo<\/span> <span class=\"st0\">&quot;deb [arch=<span class=\"es4\">$(dpkg --print-architecture)<\/span> signed-by=\/usr\/share\/keyrings\/docker.gpg] https:\/\/download.docker.com\/linux\/debian bookworm stable&quot;<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">sudo<\/span> <span class=\"kw2\">tee<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>apt<span class=\"sy0\">\/<\/span>sources.list.d<span class=\"sy0\">\/<\/span>docker.list <span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">\/<\/span>dev<span class=\"sy0\">\/<\/span>null<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"752\" height=\"134\" class=\"wp-image-24822\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-5-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-5-1.png 752w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-5-1-300x53.png 300w\" sizes=\"auto, (max-width: 752px) 100vw, 752px\" \/><\/p>\n<p><strong>Step 4: Refresh System\u2019s Packages<\/strong><\/p>\n<p>After that, update your system to implement new changes:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt update<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"754\" height=\"285\" class=\"wp-image-24823\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-6-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-6-1.png 754w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-6-1-300x113.png 300w\" sizes=\"auto, (max-width: 754px) 100vw, 754px\" \/><\/p>\n<p><strong>Step 5: Install Docker on Debian 12 System<\/strong><\/p>\n<p>Now, install the essential latest Docker packages i.e. the \u201c<strong>docker-ce<\/strong>\u201d (Docker engine\u2019s community edition), \u201c<strong>docker-ce-cli<\/strong>\u201d (a command-line interface to communicate with Docker). and \u201c<strong>containerd.io<\/strong>\u201d (container runtime) by typing out the given command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> docker-ce docker-ce-cli containerd.io<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"743\" height=\"405\" class=\"wp-image-24826\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-7-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-7-1.png 743w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-7-1-300x164.png 300w\" sizes=\"auto, (max-width: 743px) 100vw, 743px\" \/><\/p>\n<p><strong>Step 6: Verification <\/strong><\/p>\n<p>Finally, check out the <strong>Docker\u2019s <\/strong>version to ensure its installation on your system:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">docker <span class=\"re5\">--version<\/span><\/div><\/div>\n<p>It can be observed that the <strong>Docker\u2019s <\/strong>latest has been successfully installed:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"745\" height=\"111\" class=\"wp-image-24830\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-8-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-8-1.png 745w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-8-1-300x45.png 300w\" sizes=\"auto, (max-width: 745px) 100vw, 745px\" \/><\/p>\n<h3><a id=\"post-19864-_f9uoadhfgj9h\"><\/a>Method 3: Install Docker on Debian 12 From the Deb Package File<\/h3>\n<p>You can also get Docker&#8217;s latest version by downloading its Deb package file from the official Docker website and install manually. Follow the given steps to install Docker on Debian 12 via the Deb package file.<\/p>\n<p><strong>Step 1: Download Docker Package Files on Debian 12<\/strong><\/p>\n<p>First, visit the <a href=\"https:\/\/download.docker.com\/linux\/debian\/dists\/bookworm\/pool\/stable\/amd64\/\">official Docker website<\/a>, copy the link of the required latest <strong>Docker <\/strong>deb files, and download them on your system through the \u201cwget\u201d command. Here, we are downloading the Deb package files of \u201ccontainered.io\u201d, \u201cdocker-ce\u201d, and \u201cdocker-ce-cli\u201d.<\/p>\n<p><strong>For \u201ccontainerd.io\u201d:<\/strong><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">wget<\/span> https:<span class=\"sy0\">\/\/<\/span>download.docker.com<span class=\"sy0\">\/<\/span>linux<span class=\"sy0\">\/<\/span>debian<span class=\"sy0\">\/<\/span>dists<span class=\"sy0\">\/<\/span>bookworm<span class=\"sy0\">\/<\/span>pool<span class=\"sy0\">\/<\/span>stable<span class=\"sy0\">\/<\/span>amd64<span class=\"sy0\">\/<\/span>containerd.io_1.6.28-<span class=\"nu0\">1<\/span>_amd64.deb<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"737\" height=\"425\" class=\"wp-image-24834\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-9-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-9-1.png 737w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-9-1-300x173.png 300w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/p>\n<p><strong>For \u201cdocker-ce\u201d:<\/strong><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">wget<\/span> https:<span class=\"sy0\">\/\/<\/span>download.docker.com<span class=\"sy0\">\/<\/span>linux<span class=\"sy0\">\/<\/span>debian<span class=\"sy0\">\/<\/span>dists<span class=\"sy0\">\/<\/span>bookworm<span class=\"sy0\">\/<\/span>pool<span class=\"sy0\">\/<\/span>stable<span class=\"sy0\">\/<\/span>amd64<span class=\"sy0\">\/<\/span>docker-ce_25.0.3-<span class=\"nu0\">1<\/span>~debian.12~bookworm_amd64.deb<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"426\" class=\"wp-image-24838\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-10-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-10-1.png 738w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-10-1-300x173.png 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><\/p>\n<p><strong>For \u201cdocker-ce-cli\u201d:<\/strong><\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">wget<\/span> https:<span class=\"sy0\">\/\/<\/span>download.docker.com<span class=\"sy0\">\/<\/span>linux<span class=\"sy0\">\/<\/span>debian<span class=\"sy0\">\/<\/span>dists<span class=\"sy0\">\/<\/span>bookworm<span class=\"sy0\">\/<\/span>pool<span class=\"sy0\">\/<\/span>stable<span class=\"sy0\">\/<\/span>amd64<span class=\"sy0\">\/<\/span>docker-ce-cli_25.0.3-<span class=\"nu0\">1<\/span>~debian.12~bookworm_amd64.deb<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"425\" class=\"wp-image-24844\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-11-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-11-1.png 738w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-11-1-300x173.png 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><\/p>\n<p>Alternatively, you can download the desired <strong>Docker <\/strong>deb files directly from the <a href=\"https:\/\/download.docker.com\/linux\/debian\/dists\/bookworm\/pool\/stable\/amd64\/\">website<\/a> by clicking on them as seen below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"521\" class=\"wp-image-24849\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-12.png 789w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-12-300x198.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-12-768x507.png 768w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/p>\n<p><strong>Step 2: Install Docker on Debian 12<\/strong><\/p>\n<p>Then, install the downloaded deb package files using the following command to get <strong>Docker\u2019s <\/strong>latest version on your system:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> .<span class=\"sy0\">\/<\/span>containerd.io_1.6.28-<span class=\"nu0\">1<\/span>_amd64.deb .<span class=\"sy0\">\/<\/span>docker-ce_25.0.3-<span class=\"nu0\">1<\/span>~debian.12~bookworm_amd64.deb .<span class=\"sy0\">\/<\/span>docker-ce-cli_25.0.3-<span class=\"nu0\">1<\/span>~debian.12~bookworm_amd64.deb<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"514\" class=\"wp-image-24853\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-13-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-13-1.png 738w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-13-1-300x209.png 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><\/p>\n<p><strong>Step 3: Verify Installation<\/strong><\/p>\n<p>Lastly, display the <strong>Docker\u2019s <\/strong>version to confirm its installation on the system:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">docker <span class=\"re5\">--version<\/span><\/div><\/div>\n<p>The below output displays the latest version of <strong>Docker <\/strong>installed on the system:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"737\" height=\"113\" class=\"wp-image-24855\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-14-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-14-1.png 737w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-14-1-300x46.png 300w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/p>\n<h3><a id=\"post-19864-_5p0thbbd8rxz\"><\/a>Method 4: Install Docker on Debian 12 From the Snap Store<\/h3>\n<p>The Snap store also contains the <strong>Docker <\/strong>snap package that can be simply installed on Debian 12 through the \u201csnap\u201d package manager. You can install <strong>Docker <\/strong>on Debian 12 from the Snap Store by following the given steps.<\/p>\n<p><strong>Step 1: Install and Enable Snap <\/strong><\/p>\n<p>By default, the snap support is not enabled on the Debian 12 system. Thus, you have to enable it first in order to install Snap packages including Docker. <a href=\"https:\/\/linuxways.net\/de\/debian\/install-snap-on-debian-12\/\"><strong>Check Out This Post<\/strong><\/a> to see the method of installing and enabling it.<\/p>\n<p><strong>Step 2: Install Docker on Debian 12<\/strong><\/p>\n<p>Then, install the <strong>Docker <\/strong>snap package on your Debian 12 system by utilizing the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> snap <span class=\"kw2\">install<\/span> docker<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"737\" height=\"112\" class=\"wp-image-24860\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-15-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-15-1.png 737w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-15-1-300x46.png 300w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/p>\n<h3><a id=\"post-19864-_ara1opkrkwbs\"><\/a>Method 5: Install Docker on Debian 12 From Docker Shell Script<\/h3>\n<p>Another most convenient and fastest way to install <strong>Docker <\/strong>on Debian 12 is using the Docker shell script. This shell script is provided by <strong>Docker <\/strong>to automate its installation process on the system. You can go through the given instructions to install <strong>Docker <\/strong>from the shell script on Debian 12:<\/p>\n<p><strong>Step 1: Download the Shell Script on Debian 12<\/strong><\/p>\n<p>First, download the <strong>Docker <\/strong>shell script on your Debian 12 system via the \u201c<strong>curl<\/strong>\u201d command with the name \u201c<strong>get-docker.sh<\/strong>\u201d:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">curl <span class=\"re5\">-fsSL<\/span> https:<span class=\"sy0\">\/\/<\/span>get.docker.com <span class=\"re5\">-o<\/span> get-docker.sh<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"737\" height=\"93\" class=\"wp-image-24861\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-16-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-16-1.png 737w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-16-1-300x38.png 300w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/p>\n<p><strong>Step 2: Install Docker on Debian 12<\/strong><\/p>\n<p>Next, install and set up <strong>Docker <\/strong>on Debian 12 by executing the following \u201c<strong>get-docker.sh<\/strong>\u201d script file through the below-listed command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">sh<\/span> get-docker.sh<\/div><\/div>\n<p>As you can see, this shell script has installed the <strong>Docker\u2019s <\/strong>most recent version:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"534\" class=\"wp-image-24866\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-17.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-17.png 738w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-17-300x217.png 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><\/p>\n<h2><a id=\"post-19864-_brhp5vhulo8n\"><\/a>How to Manage Docker Service on Debian 12?<\/h2>\n<p>Once you have installed <strong>Docker <\/strong>on your Debian 12 system, you may want to manage its service to control Docker Daemon and containers. Managing <strong>Docker <\/strong>service includes starting, enabling, disabling, stopping, and restarting Docker services.<\/p>\n<p>Here is the way to manage your Docker (daemon) services:<\/p>\n<h3><a id=\"post-19864-_z1xizxb55dq5\"><\/a>Start Docker Service<\/h3>\n<p>After installing <strong>Docker<\/strong>, if the Docker service is not started automatically, you can run the following command to start it on your system:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl start docker<\/div><\/div>\n<h3><a id=\"post-19864-_t1nrfua9lzwe\"><\/a>Enable Docker Service<\/h3>\n<p>To set the <strong>Docker <\/strong>daemon\/service to start automatically on every system bootup, use the provided command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl <span class=\"kw3\">enable<\/span> docker<\/div><\/div>\n<h3><a id=\"post-19864-_k0kjvvsmumn2\"><\/a>Disable Docker Service<\/h3>\n<p>To prevent <strong>Docker <\/strong>services from starting automatically on system bootup, write out the below-listed command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl disable docker<\/div><\/div>\n<h3><a id=\"post-19864-_7qm5hfwaivm8\"><\/a>Stop Docker Service<\/h3>\n<p>To stop the <strong>Docker <\/strong>service on your system, you can execute the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl stop docker<\/div><\/div>\n<h3><a id=\"post-19864-_pqmo91wff2t7\"><\/a>Restart Docker Service<\/h3>\n<p>If you want to restart the <strong>Docker <\/strong>service, execute the given command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl restart docker<\/div><\/div>\n<h3><a id=\"post-19864-_qxs9ssfksfv2\"><\/a>Display Status of Docker Service<\/h3>\n<p>To view the <strong>Docker <\/strong>service\u2019s status, utilize the provided command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl status docker<\/div><\/div>\n<p>The below output shows the information about the <strong>Docker <\/strong>service:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"552\" class=\"wp-image-24871\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-18.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-18.png 738w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-18-300x224.png 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><\/p>\n<h2><a id=\"post-19864-_6zcc02eclioq\"><\/a>How to Configure Docker as a Non-root User on Debian 12?<\/h2>\n<p>On Debian systems, when you install <strong>Docker <\/strong>it generally runs with root privileges. As a result, running <strong>Docker <\/strong>commands without \u201csudo\u201d gives permission errors as seen below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"259\" class=\"wp-image-24876\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-19.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-19.png 735w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-19-300x106.png 300w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><\/p>\n<p>In order to resolve this error and run <strong>Docker <\/strong>as a non-root user on Debian 12, check out the given instructions:<\/p>\n<p><strong>Step 1: Create a Docker group<\/strong><\/p>\n<p>First, you need to make a new <strong>Docker <\/strong>by utilizing the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> groupadd docker<\/div><\/div>\n<p>This has created the new Docker group named \u201c<strong>docker<\/strong>\u201d:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"94\" class=\"wp-image-24879\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-20.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-20.png 738w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-20-300x38.png 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><\/p>\n<p><strong>Step 2: Add User to Docker Group<\/strong><\/p>\n<p>Then, use the given command to add the current (or any new\/existing) user to the <strong>docker <\/strong>group on your system:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> usermod <span class=\"re5\">-aG<\/span> docker <span class=\"re1\">$USER<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"732\" height=\"92\" class=\"wp-image-24883\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-21.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-21.png 732w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-21-300x38.png 300w\" sizes=\"auto, (max-width: 732px) 100vw, 732px\" \/><\/p>\n<p><strong>Step 3: Restart Debian 12 System<\/strong><\/p>\n<p>You have to reboot\/restart the Debian system to implement changes:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> reboot<\/div><\/div>\n<p><strong>Step 4: Verification <\/strong><\/p>\n<p>Finally, run any <strong>Docker <\/strong>command to ensure that we can use and run <strong>Docker <\/strong>as a non-root user. Here we are executing the following Docker commands:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">docker <span class=\"kw2\">ps<\/span><br \/>\ndocker images<\/div><\/div>\n<p>It can be seen that the <strong>Docker <\/strong>commands are executing without \u201csudo\u201d successfully:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"733\" height=\"175\" class=\"wp-image-24888\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-22.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-22.png 733w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-22-300x72.png 300w\" sizes=\"auto, (max-width: 733px) 100vw, 733px\" \/><\/p>\n<h2><a id=\"post-19864-_exc8r02grkid\"><\/a>How to Remove Docker From Debian 12?<\/h2>\n<p>There are various methods to remove <strong>Docker <\/strong>from Debian 12 systems because of different installation ways. You can choose the desired uninstallation method and remove <strong>Docker <\/strong>based on the way you installed it.<\/p>\n<p>Here are the <strong>Docker <\/strong>removal methods:<\/p>\n<h3><a id=\"post-19864-_laq34796a336\"><\/a>If Installed From Debian 12\/Docker Repository or Shell Script<\/h3>\n<p>If <strong>Docker<\/strong> is installed on the Debian 12 system from the default Debian repository, the official <strong>Docker <\/strong>repository, or the Docker shell script, you can remove it via the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt autoremove docker<span class=\"sy0\">*<\/span> <span class=\"re5\">--purge<\/span> <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"737\" height=\"344\" class=\"wp-image-24890\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-23.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-23.png 737w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-23-300x140.png 300w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/p>\n<p>Also, remove the added <strong>Docker <\/strong>repository from your Debian 12 system through the provided command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">rm<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>apt<span class=\"sy0\">\/<\/span>sources.list.d<span class=\"sy0\">\/<\/span>docker.list<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"746\" height=\"94\" class=\"wp-image-24891\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-24.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-24.png 746w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-24-300x38.png 300w\" sizes=\"auto, (max-width: 746px) 100vw, 746px\" \/><\/p>\n<p>Likewise, remove the <strong>Docker <\/strong>GPG key from the system using the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">rm<\/span> <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>share<span class=\"sy0\">\/<\/span>keyrings<span class=\"sy0\">\/<\/span>docker.gpg<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"745\" height=\"94\" class=\"wp-image-24892\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-25.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-25.png 745w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-25-300x38.png 300w\" sizes=\"auto, (max-width: 745px) 100vw, 745px\" \/><\/p>\n<h3><a id=\"post-19864-_azpcz6rqzixb\"><\/a>If Installed From Deb Packages Files<\/h3>\n<p>If you have installed <strong>Docker <\/strong>on your system from the deb packages files, type out the given command to remove it from the Debian 12 system:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt remove docker-ce containerd.io docker-ce-cli<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"451\" class=\"wp-image-24894\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-26.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-26.png 738w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-26-300x183.png 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><\/p>\n<h3><a id=\"post-19864-_ubg84wxrg0ca\"><\/a>If Installed From the Snap Store<\/h3>\n<p>You can use the provided command to remove <strong>Docker <\/strong>from Debian 12 if it is installed from the Snap Store:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> snap remove docker<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"734\" height=\"110\" class=\"wp-image-24895\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-27.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-27.png 734w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/07\/word-image-19864-27-300x45.png 300w\" sizes=\"auto, (max-width: 734px) 100vw, 734px\" \/><\/p>\n<p>That is all about installing, managing, and uninstalling <strong>Docker <\/strong>on Debian 12 systems.<\/p>\n<p><strong>Note:<\/strong> For additional information, see <a href=\"https:\/\/docs.docker.com\/engine\/install\/debian\/\">Docker&#8217;s official documentation<\/a>.<\/p>\n<h2><a id=\"post-19864-_e46bzgpxucci\"><\/a>Final Thoughts<\/h2>\n<p>You can install <strong>Docker <\/strong>on the Debian 12 system from the default Debian repository, official Docker repository, Snap Store, deb files, or Docker shell script. In these methods, the Docker official repository and the deb package file methods are most recommended as these provide the most up-to-date version of <strong>Docker <\/strong>with the latest features and updates. On the other hand, the default Debian repository and Docker shell script method are the simplest and fastest ways to install <strong>Docker<\/strong>. This article has illustrated all the potential approaches to install, configure, manage, and remove <strong>Docker <\/strong>on Debian 12.<\/p>","protected":false},"excerpt":{"rendered":"<p>Docker is a platform that can be used to deploy applications in container format. There are several ways that can be followed to install Docker in Debian 12. <\/p>","protected":false},"author":112,"featured_media":19880,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-19864","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/19864","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/112"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=19864"}],"version-history":[{"count":1,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/19864\/revisions"}],"predecessor-version":[{"id":24846,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/19864\/revisions\/24846"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/19880"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=19864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=19864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=19864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}