{"id":4153,"date":"2025-10-29T15:29:35","date_gmt":"2025-10-29T07:29:35","guid":{"rendered":"https:\/\/www.servergigabit.com\/guide\/?post_type=kb&#038;p=4153"},"modified":"2026-01-09T14:08:20","modified_gmt":"2026-01-09T06:08:20","slug":"install-docker-on-ubuntu","status":"publish","type":"kb","link":"https:\/\/www.servergigabit.com\/guide\/kb\/install-docker-on-ubuntu","title":{"rendered":"Easy and Complete Guide to Install Docker on Ubuntu"},"content":{"rendered":"<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/www.eginnovations.com\/tech-icons\/Uploads\/docket_logo.webp\" alt=\"Install Docker on Ubuntu\" width=\"361\" height=\"93\" \/><\/p>\n<h4>Here\u2019s a step-by-step guide to Install Docker on Ubuntu<strong>\u00a0<\/strong>(20.04, 22.04, or later) \u2014 clean, safe, and following Docker\u2019s official documentation.<\/h4>\n<h4><strong>Step 1: Uninstall Old Versions (if any)<\/strong><\/h4>\n<pre><code class=\"language-bash\">sudo apt remove docker docker-engine docker.io containerd runc\r\n<\/code><\/pre>\n<h4><strong>Step 2: Update Packages and Install Dependencies<\/strong><\/h4>\n<pre><code class=\"language-bash\">sudo apt update\r\nsudo apt install -y ca-certificates curl gnupg lsb-release\r\n<\/code><\/pre>\n<h4><strong>Step 3: Add Docker\u2019s Official GPG Key<\/strong><\/h4>\n<pre><code class=\"language-bash\">sudo install -m 0755 -d \/etc\/apt\/keyrings\r\ncurl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo gpg --dearmor -o \/etc\/apt\/keyrings\/docker.gpg\r\nsudo chmod a+r \/etc\/apt\/keyrings\/docker.gpg\r\n<\/code><\/pre>\n<h4><strong>Step 4: Add the Docker Repository<\/strong><\/h4>\n<pre><code class=\"language-bash\">echo \\\r\n  \"deb [arch=$(dpkg --print-architecture) signed-by=\/etc\/apt\/keyrings\/docker.gpg] \\\r\n  https:\/\/download.docker.com\/linux\/ubuntu \\\r\n  $(lsb_release -cs) stable\" | \\\r\n  sudo tee \/etc\/apt\/sources.list.d\/docker.list &gt; \/dev\/null\r\n<\/code><\/pre>\n<h4><strong>Step 5: Install Docker Engine<\/strong><\/h4>\n<pre><code class=\"language-bash\">sudo apt update\r\nsudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin\r\n<\/code><\/pre>\n<h4><strong>Step 6: Verify Docker Installation<\/strong><\/h4>\n<p>Check the version:<\/p>\n<pre><code class=\"language-bash\">docker --version\r\n<\/code><\/pre>\n<p>Run the test image:<\/p>\n<pre><code class=\"language-bash\">sudo docker run hello-world\r\n<\/code><\/pre>\n<p>You should see a message saying <strong>\u201cHello from Docker!\u201d<\/strong><\/p>\n<h4><strong>(Optional) Step 7: Run Docker Without <code>sudo<\/code><\/strong><\/h4>\n<p>To avoid typing <code>sudo<\/code> for every command:<\/p>\n<pre><code class=\"language-bash\">sudo usermod -aG docker $USER\r\nnewgrp docker\r\n<\/code><\/pre>\n<p>Then test:<\/p>\n<pre><code class=\"language-bash\">docker ps\r\n<\/code><\/pre>\n<hr \/>\n<p>\u2705 <strong>Done!<\/strong> You now have Docker Engine, Docker Compose, and Buildx installed and ready to use on <a href=\"https:\/\/ubuntu.com\/\" rel=\"nofollow noopener\" target=\"_blank\">Ubuntu<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p>If you need to know about Docker, you can visit <a href=\"https:\/\/www.servergigabit.com\/guide\/kb\/docker-in-action-revolutionizing-application-deployment\">here.<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here\u2019s a step-by-step guide to Install Docker on Ubuntu\u00a0(20.04, 22.04, or later) \u2014 clean, safe, and following Docker\u2019s official documentation. Step 1: Uninstall Old Versions (if any) sudo apt remove docker docker-engine docker.io containerd runc Step 2: Update Packages and Install Dependencies sudo apt update sudo apt install -y ca-certificates curl gnupg lsb-release Step 3: Add Docker\u2019s Official GPG Key&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"kbtopic":[73,77,56],"kbtag":[1108,1109],"class_list":["post-4153","kb","type-kb","status-publish","hentry","kbtopic-hosting-tools","kbtopic-server","kbtopic-ubuntu","kbtag-docker","kbtag-ubuntu"],"_links":{"self":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/4153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/comments?post=4153"}],"version-history":[{"count":8,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/4153\/revisions"}],"predecessor-version":[{"id":5569,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/4153\/revisions\/5569"}],"wp:attachment":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/media?parent=4153"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=4153"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtag?post=4153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}