{"id":15986,"date":"2019-03-14T13:42:49","date_gmt":"2019-03-14T13:42:49","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=15986"},"modified":"2026-03-09T19:19:41","modified_gmt":"2026-03-09T19:19:41","slug":"how-to-install-docker-on-centos","status":"publish","type":"post","link":"\/ng\/tutorials\/how-to-install-docker-on-centos\/","title":{"rendered":"How to install Docker on CentOS 9 Stream + Docker Compose"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>Many sysadmins use Docker in their work because of the advantages it provides when handling containers in Linux. Docker is used primarily for the deployment of images containing applications or services that we want to install in our network.<\/p><p>This tutorial will show you how to install Docker on CentOS 9 Stream, and then how to install Docker Compose to empower your VPS even more.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Linux-Commands-Cheat-Sheet.pdf\"><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"566\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-69262\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure>\n<\/div><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-understanding-docker-and-containers\">Understanding Docker and containers<\/h2><p><a href=\"\/ng\/tutorials\/what-is-docker\/\">Docker<\/a> is an open source technology that manages and automates the deployment of applications through a container. These containers are distributed through images that contain everything necessary to run an application. For example, there are images from WordPress, Nginx, MariaDB and many other services or applications.<\/p><p>The main advantage of using Docker is that we can &ldquo;install&rdquo; services or applications on many systems regardless of the hardware. For example, we can make an image of our application, and it can run on any computer that has Docker installed. All this regardless of the operating system or hardware in question.<\/p><p>Best of all, starting to use this utility is easy. Let&rsquo;s learn how to Install Docker on CentOS 9 Sream.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-install-docker-on-centos-9-stream\">How to install Docker on CentOS 9 Stream<\/h2><p>Installing Docker on CentOS 9 is simple. To do this, it is necessary to connect to our server using SSH. Check out our <a href=\"\/ng\/tutorials\/how-to-use-putty-ssh\/\">PuTTY tutorial<\/a> if you&rsquo;re having issues.<\/p><pre class=\"wp-block-preformatted\">ssh your-user@your-server<\/pre><p>Then, we have to install a series of packages prior to installing Docker. We need to be the root user and run the following line in the command line:<\/p><pre class=\"wp-block-preformatted\">yum install -y yum-utils device-mapper-persistent-data lvm2<\/pre><p>The easiest and safest way to complete the process is through Docker&rsquo;s official repositories. To do this, it is necessary to execute this line:<\/p><pre class=\"wp-block-preformatted\">yum-config-manager &nbsp;--add-repo https:\/\/download.docker.com\/linux\/centos\/docker-ce.repo<\/pre><p>After that, we can install Docker on CentOS 9 Stream by running the following command:<\/p><pre class=\"wp-block-preformatted\">yum install docker-ce<\/pre><p>We now know how to install Docker on CentOS. But it&rsquo;s not running yet! To enable and start docker, execute the following commands:<\/p><pre class=\"wp-block-preformatted\">systemctl enable docker<\/pre><pre class=\"wp-block-preformatted\">systemctl start docker<\/pre><p>Finally, we can check the status of the service to check that everything has gone well:<\/p><pre class=\"wp-block-preformatted\">systemctl status docker<\/pre><p>In the output we should see a green line indicating that Docker is up and running.<\/p><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Pro Tip                <\/p>\n            <\/div>\n            <p class=\"protip__content\">Hostinger VPS plans also offer a convenient <b>Ubuntu 24.04 64bit with Docker<\/b> operating system template. All you need to do is navigate to the <b>Operating System<\/b> section and select it under the <b>Applications<\/b> drop-down menu. Learn more about <a href=\"\/ng\/vps\/docker-hosting\">Hostinger's Docker VPS<\/a> solution.<\/p>\n                    <\/div>\n        \n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-docker-basics\">Docker basics<\/h2><p>First, let us run Docker&rsquo;s &ldquo;Hello World&rdquo; command as a start. To do it, we need to run the following command:<\/p><pre class=\"wp-block-preformatted\">docker run hello-world<\/pre><p>This test image is the one that Docker recommends checking every time you reinstall the utility.<\/p><p>We can verify all the images we have in our system with this command:<\/p><pre class=\"wp-block-preformatted\">docker images<\/pre><p>Or search the Docker repository for an available image with the search command.<\/p><pre class=\"wp-block-preformatted\">docker search [search]<\/pre><p>For example, we can search for an image related to CentOS 9.<\/p><pre class=\"wp-block-preformatted\">docker search centos9<\/pre><p>And if we want to download it, we can do it with the following command:<\/p><pre class=\"wp-block-preformatted\">docker pull [image_name]<\/pre><p>Finally, to execute it we will use the run command. We will be able to call the image by its ID or directly by its name.<\/p><pre class=\"wp-block-preformatted\">docker run -t -i [image_id or image_name]<\/pre><p>The option <strong>-i<\/strong> means that we will make the image interactive, while the option <strong>-t<\/strong> means we will have access to a terminal and can simulate one.<\/p><p>To exit from an image, we need to press <strong>CTRL+D<\/strong>.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-install-docker-compose-on-centos-9-stream\">How to install Docker Compose on CentOS 9 Stream<\/h2><p>Docker Compose is a utility that allows us to display images in Docker. It was created because many programs require other services to run. For example, with WordPress or another CMS, we require a functional web server, the image of a database manager, and finally the image of the application.<\/p><p>We would have to deploy them one by one and configure them. With Docker Composer we can define everything in a file, with all the images dependent on the main one and load them normally.<\/p><p>To install Docker Compose on CentOS 9 Stream, we need to run this command:<\/p><pre class=\"wp-block-preformatted\">curl -L \"https:\/\/github.com\/docker\/compose\/releases\/download\/1.23.2\/docker-compose-$(uname -s)-$(uname -m)\" -o \/usr\/local\/bin\/docker-compose<\/pre><p>In case we do not have curl installed, we can do it using the following command:<\/p><pre class=\"wp-block-preformatted\">yum install curl<\/pre><p>Then, <a href=\"\/ng\/tutorials\/vps\/change-linux-permissions-and-owners\/\">change the permissions using the chmod command<\/a> to make the Docker Compose binary executable:<\/p><pre class=\"wp-block-preformatted\">chmod +x \/usr\/local\/bin\/docker-compose<\/pre><p>And now, to ensure there are no problems when using the utility in the terminal, we will have to <a href=\"\/ng\/tutorials\/how-to-create-symbolic-links-in-linux\/\">make a symbolic link<\/a> to the system:<\/p><pre class=\"wp-block-preformatted\">ln -s \/usr\/local\/bin\/docker-compose \/usr\/bin\/docker-compose<\/pre><p>Finally, check the installed version:<\/p><pre class=\"wp-block-preformatted\">docker-compose --version<\/pre><p>And we&rsquo;re ready to use both Docker, and Docker Compose.<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>The deployment of applications in the form of containers can help you avoid compatibility issues. In addition, Docker facilitates the installation and maintenance of existing containers. By adding a tool such as Compose to Docker&rsquo;s technology, productivity and efficiency can be improved even further.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many sysadmins use Docker in their work because of the advantages it provides when handling containers in Linux. Docker is used primarily for the deployment of images containing applications or services that we want to install in our network. This tutorial will show you how to install Docker on CentOS 9 Stream, and then how [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/how-to-install-docker-on-centos\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":110,"featured_media":145112,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Install Docker on CentOS 9","rank_math_description":"Learn how you can improve your development toolset with a new utility! Learn how to install Docker on CentOS 9. Docker Compose included!","rank_math_focus_keyword":"install docker centos","footnotes":""},"categories":[22644],"tags":[],"class_list":["post-15986","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-install-docker-on-centos","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/instalar-docker-centos","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/cara-install-docker-centos","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-install-docker-on-centos","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-install-docker-on-centos","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-install-docker-on-centos","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/instalar-docker-centos","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/instalar-docker-centos","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/instalar-docker-centos","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-install-docker-on-centos","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-install-docker-on-centos","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-install-docker-on-centos","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-install-docker-on-centos","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/15986","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=15986"}],"version-history":[{"count":21,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/15986\/revisions"}],"predecessor-version":[{"id":145111,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/15986\/revisions\/145111"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media\/145112"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=15986"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=15986"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=15986"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}