{"id":124461,"date":"2024-07-07T12:59:17","date_gmt":"2024-07-07T12:59:17","guid":{"rendered":"https:\/\/linuxiac.com\/?p=124461"},"modified":"2024-08-04T21:46:01","modified_gmt":"2024-08-04T21:46:01","slug":"how-to-install-docker-on-arch-linux","status":"publish","type":"post","link":"https:\/\/linuxiac.com\/how-to-install-docker-on-arch-linux\/","title":{"rendered":"How to Install Docker on Arch Linux: A Step-by-Step Guide"},"content":{"rendered":"\n<p>If you\u2019re venturing into the world of containerization and looking for an efficient way to deploy applications, Docker is the tool you need. But what\u2019s better than harnessing the power of containerization on a distro that keeps you on the cutting edge?<\/p>\n\n\n\n<p>Arch&#8217;s <a href=\"https:\/\/linuxiac.com\/rolling-vs-point-release-linux-distributions\/\" data-type=\"post\" data-id=\"58207\">rolling release nature<\/a> ensures that you always work with the latest software, a significant advantage for developers who want to stay ahead of the curve.<\/p>\n\n\n\n<p>In this guide, we\u2019ll go through a detailed, step-by-step process to install Docker on <a href=\"https:\/\/linuxiac.com\/archlinux\/\">Arch Linux<\/a>, enabling you to leverage container technology for your projects effortlessly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>Before we start, ensure that you have:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A running Arch Linux system.<\/li>\n\n\n\n<li>A user account with <code>sudo<\/code> privileges.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Update Your System<\/h2>\n\n\n\n<p>First, it&#8217;s a good practice to update your system to ensure all existing packages are up to date. This minimizes compatibility issues. Open your terminal and run the following <a href=\"https:\/\/linuxiac.com\/how-to-use-pacman-to-manage-software-on-arch-linux\/\" data-type=\"post\" data-id=\"3808\">Pacman command<\/a>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo pacman -Syu<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>This command will fetch the latest package databases and upgrade all the installed packages to their latest versions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Install Docker on Arch Linux<\/h2>\n\n\n\n<p>Installing Docker on Arch is straightforward, thanks to the availability of Docker in the official Arch repository. Execute the following command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo pacman -S docker docker-compose docker-buildx<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-01.jpg\"><img decoding=\"async\" width=\"917\" height=\"308\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-01.jpg\" alt=\"Install Docker on Arch Linux\" class=\"wp-image-124485\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-01.jpg 917w, https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-01-380x128.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-01-768x258.jpg 768w\" sizes=\"(max-width: 917px) 100vw, 917px\" \/><\/a><figcaption class=\"wp-element-caption\">Install Docker on Arch Linux<\/figcaption><\/figure>\n\n\n\n<p>As you&#8217;ve noticed, in addition to the Docker itself, we&#8217;re installing a few additional helpful components, specifically:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>docker<\/strong>: The Docker engine itself.<\/li>\n\n\n\n<li><strong>docker-compose<\/strong>: A configuration management tool to orchestrate the creation and management of Docker multi-container deployments using compose files.<\/li>\n\n\n\n<li><strong>docker-buildx<\/strong>: A CLI tool that&nbsp;extends the native Docker build with many new features, allowing you to build container images for multiple platforms.<\/li>\n<\/ul>\n\n\n\n<p>That\u2019s all! Docker should now be installed; however, there are a few minor things to do before using it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Start and Enable Docker Service<\/h2>\n\n\n\n<p>To ensure Docker starts automatically at boot, enable and start the service:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo systemctl <span class=\"hljs-built_in\">enable<\/span> --now docker.service<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-02.jpg\"><img decoding=\"async\" width=\"991\" height=\"124\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-02.jpg\" alt=\"Start and enable the Docker service.\" class=\"wp-image-124506\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-02.jpg 991w, https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-02-380x48.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-02-768x96.jpg 768w\" sizes=\"(max-width: 991px) 100vw, 991px\" \/><\/a><figcaption class=\"wp-element-caption\">Start and enable the Docker service.<\/figcaption><\/figure>\n\n\n\n<p>Let\u2019s check its status.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo systemctl is-active docker.service<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-03.jpg\"><img decoding=\"async\" width=\"939\" height=\"106\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-03.jpg\" alt=\"Check if the Docker service is started.\" class=\"wp-image-124512\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-03.jpg 939w, https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-03-380x43.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-03-768x87.jpg 768w\" sizes=\"(max-width: 939px) 100vw, 939px\" \/><\/a><figcaption class=\"wp-element-caption\">Check if the Docker service is started.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Verify Installation<\/h2>\n\n\n\n<p>Now, let\u2019s check if everything works properly. For this purpose, we will run a simple Docker application called \u201c<em>hello-world<\/em>.\u201d<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">sudo docker run hello-world<\/code><\/span><\/pre>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-05.jpg\"><img decoding=\"async\" width=\"966\" height=\"772\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-05.jpg\" alt=\"Docker successfully installed, up &amp; running on Arch Linux.\" class=\"wp-image-124524\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-05.jpg 966w, https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-05-380x304.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-05-768x614.jpg 768w\" sizes=\"(max-width: 966px) 100vw, 966px\" \/><\/a><figcaption class=\"wp-element-caption\">Docker successfully installed, up &amp; running on Arch Linux.<\/figcaption><\/figure>\n\n\n\n<p>Congratulations! As we can see, everything works as expected!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Enabling Non-root Users to Run Docker Commands<\/h2>\n\n\n\n<p>So far, we have successfully installed Docker on the Arch system. However, by default, only root and users with&nbsp;<a href=\"https:\/\/linuxiac.com\/make-sudo-remember-password-longer\/\" target=\"_blank\" rel=\"noreferrer noopener\">sudo privileges<\/a> can execute Docker commands.<\/p>\n\n\n\n<p>In other words, if you attempt to run the&nbsp;<code>docker<\/code>&nbsp;command without prefixing it with&nbsp;<code>sudo<\/code>, you\u2019ll get an error message like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-06.jpg\"><img decoding=\"async\" width=\"997\" height=\"148\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-06.jpg\" alt=\"Docker permission denied.\" class=\"wp-image-124527\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-06.jpg 997w, https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-06-380x56.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-06-768x114.jpg 768w\" sizes=\"(max-width: 997px) 100vw, 997px\" \/><\/a><figcaption class=\"wp-element-caption\">Docker permission denied.<\/figcaption><\/figure>\n\n\n\n<p>But there is no room for worries. To run Docker commands as a non-root user, you must first add your user to the \u201c<em>docker<\/em>\u201d group. It is a simple task. To do that, type in the following:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo usermod -aG docker <span class=\"hljs-variable\">${USER}<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In the above command,&nbsp;\u201c<em>${USER}<\/em>\u201d&nbsp;is a&nbsp;system environment variable&nbsp;that contains your username. Then, run the following command to activate the changes to the group:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">newgrp docker<\/code><\/span><\/pre>\n\n\n<p>You can then execute <code>docker<\/code> commands without prefixing them with <code>sudo<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-07.jpg\"><img decoding=\"async\" width=\"997\" height=\"148\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-07.jpg\" alt=\"Run the docker command as a regular user.\" class=\"wp-image-124530\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-07.jpg 997w, https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-07-380x56.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2024\/07\/arch-docker-07-768x114.jpg 768w\" sizes=\"(max-width: 997px) 100vw, 997px\" \/><\/a><figcaption class=\"wp-element-caption\">Run the docker command as a regular user.<\/figcaption><\/figure>\n\n\n\n<p>Remember that this solution will work only for your current terminal session. In other words, if you close the terminal, you will either have to execute the <code>newgrp<\/code> command above again or prefix <code>docker<\/code> commands with <code>sudo<\/code>. To make this change last permanently, just reboot your Arch system.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Installing Docker on Arch Linux is straightforward and allows you to benefit from the latest features and improvements in Docker technology. You\u2019re now ready to containerize applications and fully take advantage of Docker&#8217;s efficiencies and portability.<\/p>\n\n\n\n<p>To learn more about Docker, check out its official&nbsp;<a href=\"https:\/\/docs.docker.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">documentation<\/a>. Additionally, we recommend&nbsp;<a href=\"https:\/\/linuxiac.com\/how-to-install-and-use-docker-compose\/\">our detailed guide<\/a>&nbsp;to expanding your skills with Docker and learning how to run and manage multi-container applications using Docker Compose.<\/p>\n\n\n\n<p>As always, if you encounter any issues or have questions, let me know in the comments section below. Thank you for following this tutorial, and happy Dockerizing!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Your guide to installing Docker on Arch Linux. Simple, practical steps tailored for beginners and experts alike.<\/p>\n","protected":false},"author":10,"featured_media":124464,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,4417],"tags":[4264,1439],"class_list":["post-124461","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-linux-knowledge","tag-arch-linux","tag-docker"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/posts\/124461","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/comments?post=124461"}],"version-history":[{"count":0,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/posts\/124461\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/media\/124464"}],"wp:attachment":[{"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/media?parent=124461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/categories?post=124461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/tags?post=124461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}