{"id":945,"date":"2024-08-09T10:16:58","date_gmt":"2024-08-09T10:16:58","guid":{"rendered":"https:\/\/zahiralam.com\/blog\/?p=945"},"modified":"2024-08-29T08:30:29","modified_gmt":"2024-08-29T08:30:29","slug":"quickly-install-docker-on-your-ubuntu-24-04-system","status":"publish","type":"post","link":"https:\/\/zahiralam.com\/blog\/quickly-install-docker-on-your-ubuntu-24-04-system\/","title":{"rendered":"Quickly Install Docker on Your Ubuntu 24.04 System"},"content":{"rendered":"\n<p>Docker is a popular containerization platform that allows you to package, deploy, and run applications in a standardized environment. With Docker, you can manage your applications as lightweight containers that are portable and consistent across different environments. In this guide, we&#8217;ll walk you through the steps to install Docker on Ubuntu 24.04 (LTS).\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>Before you begin, ensure that you have the following:\n\n\n\n<ul class=\"wp-block-list\">\n<li>A 64-bit version of Ubuntu 24.04 (LTS)<\/li>\n\n\n\n<li>A user account with <code>sudo<\/code> privileges<\/li>\n<\/ul>\n\n\n\n<p>Docker supports multiple architectures, including <code>x86_64<\/code>, <code>armhf<\/code>, <code>arm64<\/code>, <code>s390x<\/code>, and <code>ppc64le<\/code>.\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Update Your System<\/h2>\n\n\n\n<p>Before installing any new software, it&#8217;s a good practice to update your system&#8217;s package list. Open a terminal and run the following command:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-1\">sudo apt-get update<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#sudo%20apt-get%20update\">\n                            <button class=\"copy-button\" data-label=\"sudo apt-get update\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<p>This command updates the list of available packages and their versions.\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Install Required Packages<\/h2>\n\n\n\n<p>To set up Docker on your system, you need to install a few prerequisite packages. These packages help in adding the Docker repository and managing the keys securely:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-2\">sudo apt-get install ca-certificates curl gnupg<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#sudo%20apt-get%20install%20ca-certificates%20curl%20gnupg\">\n                            <button class=\"copy-button\" data-label=\"sudo apt-get install ca-certificates curl gnupg\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<p>This command installs <code>ca-certificates<\/code>, <code>curl<\/code>, and <code>gnupg<\/code>, which are required for Docker installation.\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Add Docker\u2019s Official GPG Key<\/h2>\n\n\n\n<p>Next, you need to add Docker\u2019s official GPG key to your system. This key ensures that the software you\u2019re about to install is authentic and hasn\u2019t been tampered with:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-3\">sudo install -m 0755 -d \/etc\/apt\/keyrings\ncurl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo gpg --dearmor -o \/etc\/apt\/keyrings\/docker.gpg\nsudo chmod a+r \/etc\/apt\/keyrings\/docker.gpg<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#sudo%20install%20-m%200755%20-d%20%2Fetc%2Fapt%2Fkeyrings%0Acurl%20-fsSL%20https%3A%2F%2Fdownload.docker.com%2Flinux%2Fubuntu%2Fgpg%20%7C%20sudo%20gpg%20--dearmor%20-o%20%2Fetc%2Fapt%2Fkeyrings%2Fdocker.gpg%0Asudo%20chmod%20a%2Br%20%2Fetc%2Fapt%2Fkeyrings%2Fdocker.gpg\">\n                            <button class=\"copy-button\" data-label=\"sudo install -m 0755 -d \/etc\/apt\/keyrings\ncurl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo gpg --dearmor -o \/etc\/apt\/keyrings\/docker.gpg\nsudo chmod a+r \/etc\/apt\/keyrings\/docker.gpg\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<p>This will download the GPG key and place it in the appropriate directory on your system.\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Set Up Docker Repository<\/h2>\n\n\n\n<p>With the GPG key added, you can now add the Docker repository to your system\u2019s list of repositories:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-4\">echo \\\n  &quot;deb [arch=$(dpkg --print-architecture) signed-by=\/etc\/apt\/keyrings\/docker.gpg] https:\/\/download.docker.com\/linux\/ubuntu \\\n  $(. \/etc\/os-release &amp;&amp; echo &quot;$VERSION_CODENAME&quot;) stable&quot; | \\\n  sudo tee \/etc\/apt\/sources.list.d\/docker.list &gt; \/dev\/null<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#echo%20%5C%0A%20%20%22deb%20%5Barch%3D%24%28dpkg%20--print-architecture%29%20signed-by%3D%2Fetc%2Fapt%2Fkeyrings%2Fdocker.gpg%5D%20https%3A%2F%2Fdownload.docker.com%2Flinux%2Fubuntu%20%5C%0A%20%20%24%28.%20%2Fetc%2Fos-release%20%26%26%20echo%20%22%24VERSION_CODENAME%22%29%20stable%22%20%7C%20%5C%0A%20%20sudo%20tee%20%2Fetc%2Fapt%2Fsources.list.d%2Fdocker.list%20%3E%20%2Fdev%2Fnull\">\n                            <button class=\"copy-button\" data-label=\"echo \\\n  &quot;deb [arch=$(dpkg --print-architecture) signed-by=\/etc\/apt\/keyrings\/docker.gpg] https:\/\/download.docker.com\/linux\/ubuntu \\\n  $(. \/etc\/os-release &amp;&amp; echo &quot;$VERSION_CODENAME&quot;) stable&quot; | \\\n  sudo tee \/etc\/apt\/sources.list.d\/docker.list &gt; \/dev\/null\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<p>This command sets up the repository from which Docker can be installed and updated.\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Install Docker Engine<\/h2>\n\n\n\n<p>With the repository set up, you can now install Docker Engine and its associated components:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-5\">sudo apt-get update\nsudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#sudo%20apt-get%20update%0Asudo%20apt-get%20install%20docker-ce%20docker-ce-cli%20containerd.io%20docker-buildx-plugin%20docker-compose-plugin\">\n                            <button class=\"copy-button\" data-label=\"sudo apt-get update\nsudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<p>This installs the latest version of Docker, including the Docker Engine, Docker CLI, and additional plugins.\n\n\n\n<h2 class=\"wp-block-heading\">Step 6: Verify Docker Installation<\/h2>\n\n\n\n<p>After the installation is complete, you can verify that Docker was installed correctly by running the <code>hello-world<\/code> image:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-6\">sudo docker run hello-world<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#sudo%20docker%20run%20hello-world\">\n                            <button class=\"copy-button\" data-label=\"sudo docker run hello-world\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<p>If everything is working properly, you should see a message that says &#8220;Hello from Docker!&#8221; This confirms that Docker is installed and running.\n\n\n\n<h2 class=\"wp-block-heading\">Step 7: Post-Installation Steps (Optional)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">7.1 Run Docker Commands Without Sudo<\/h3>\n\n\n\n<p>By default, Docker commands require <code>sudo<\/code> privileges. If you want to allow your user to run Docker commands without <code>sudo<\/code>, follow these steps:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-7\">sudo groupadd docker\nsudo usermod -aG docker $USER\nnewgrp docker\n#restart your pc<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#sudo%20groupadd%20docker%0Asudo%20usermod%20-aG%20docker%20%24USER%0Anewgrp%20docker%0A%23restart%20your%20pc\">\n                            <button class=\"copy-button\" data-label=\"sudo groupadd docker\nsudo usermod -aG docker $USER\nnewgrp docker\n#restart your pc\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<p>After running these commands, log out and log back in to apply the changes.\n\n\n\n<h3 class=\"wp-block-heading\">7.2 Enable Docker to Start on Boot<\/h3>\n\n\n\n<p>To ensure that Docker starts automatically when your system boots, run the following command:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-8\">sudo systemctl enable docker<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#sudo%20systemctl%20enable%20docker\">\n                            <button class=\"copy-button\" data-label=\"sudo systemctl enable docker\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<p>This will configure Docker to start automatically each time your system starts up.\n\n\n\n<h2 class=\"wp-block-heading\">Step 8: Upgrading Docker Engine<\/h2>\n\n\n\n<p>To upgrade Docker Engine to a newer version, simply update your package index and install the latest version:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-9\">sudo apt-get update\nsudo apt-get upgrade docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#sudo%20apt-get%20update%0Asudo%20apt-get%20upgrade%20docker-ce%20docker-ce-cli%20containerd.io%20docker-buildx-plugin%20docker-compose-plugin\">\n                            <button class=\"copy-button\" data-label=\"sudo apt-get update\nsudo apt-get upgrade docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<p>This will upgrade Docker to the latest version available in the repository.\n\n\n\n<h2 class=\"wp-block-heading\">Uninstalling Docker Engine<\/h2>\n\n\n\n<p>If you ever need to uninstall Docker, you can do so with the following command:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-10\">sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#sudo%20apt-get%20purge%20docker-ce%20docker-ce-cli%20containerd.io%20docker-buildx-plugin%20docker-compose-plugin\">\n                            <button class=\"copy-button\" data-label=\"sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<p>If you want to remove all Docker data, including images, containers, and volumes, you can do so by running:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-11\">sudo rm -rf \/var\/lib\/docker\nsudo rm -rf \/var\/lib\/containerd<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#sudo%20rm%20-rf%20%2Fvar%2Flib%2Fdocker%0Asudo%20rm%20-rf%20%2Fvar%2Flib%2Fcontainerd\">\n                            <button class=\"copy-button\" data-label=\"sudo rm -rf \/var\/lib\/docker\nsudo rm -rf \/var\/lib\/containerd\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Congratulations! You&#8217;ve successfully installed Docker on your Ubuntu 24.04 (LTS) system. Docker is now ready to help you create, deploy, and manage containers efficiently. Whether you are developing locally or deploying in production, Docker provides a robust and flexible platform for all your containerization needs.\n\n\n\n<p>If you encounter any issues or need further information, the official <a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/\" target=\"_blank\" rel=\"noreferrer noopener\">Docker documentation<\/a> is a great resource.\n\n\n\n<p>Additionally, feel free to leave comments or questions below for further clarification!\n\n\n\n<p>\n","protected":false},"excerpt":{"rendered":"<p>Docker is a popular containerization platform that allows you to package, deploy, and run applications in a standardized environment. With Docker, you can manage your [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":952,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[214],"tags":[224,225,66],"class_list":["post-945","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-installation","tag-containerization","tag-docker-installation","tag-ubuntu-24-04"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/posts\/945","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/comments?post=945"}],"version-history":[{"count":4,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/posts\/945\/revisions"}],"predecessor-version":[{"id":1034,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/posts\/945\/revisions\/1034"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/media\/952"}],"wp:attachment":[{"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/media?parent=945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/categories?post=945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/tags?post=945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}