{"id":3144,"date":"2018-12-26T15:26:18","date_gmt":"2018-12-26T09:56:18","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=3144"},"modified":"2026-10-02T14:42:56","modified_gmt":"2026-10-02T09:12:56","slug":"how-to-install-docker-in-centos-7","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-install-docker-in-centos-7\/","title":{"rendered":"How to install Docker in Centos 7"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Post Date:<\/strong> December 26, 2018 <br><strong>Last Updated:<\/strong> October 02, 2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This guide explains how to install and uninstall Docker CE on CentOS 7.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One note upfront: <strong>CentOS 7 reached end-of-life in June 2024<\/strong> and no longer receives security updates. The steps below still work on CentOS 7 if you&#8217;re maintaining an existing system, but for a new server, AlmaLinux or Rocky Linux (both RHEL-compatible, currently supported) are the better foundation \u2014 Docker&#8217;s installation process is identical on either.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A maintained\/currently supported version of CentOS 7 (archived\/EOL repo mirrors aren&#8217;t tested or supported by Docker)<\/li>\n\n\n\n<li>Root or sudo access<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Architecture<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <strong>Docker daemon<\/strong> (<code>dockerd<\/code>) runs as a background service, managing containers, images, and networks<\/li>\n\n\n\n<li>The <strong>Docker CLI<\/strong> (<code>docker<\/code> command) talks to that daemon to start, stop, and manage containers<\/li>\n\n\n\n<li>Containers share the host&#8217;s kernel, which is why they start much faster and use fewer resources than a full virtual machine<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/ChatGPT-Image-Oct-2-2026-02_36_24-PM.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/ChatGPT-Image-Oct-2-2026-02_36_24-PM-1024x683.png\" alt=\"\" class=\"wp-image-12065\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/ChatGPT-Image-Oct-2-2026-02_36_24-PM-1024x683.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/ChatGPT-Image-Oct-2-2026-02_36_24-PM-300x200.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/ChatGPT-Image-Oct-2-2026-02_36_24-PM-768x512.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/ChatGPT-Image-Oct-2-2026-02_36_24-PM-272x182.png 272w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/ChatGPT-Image-Oct-2-2026-02_36_24-PM.png 1536w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Steps<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Uninstall Older Docker Versions (If Present)<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">yum remove docker \\\n    docker-client \\\n    docker-client-latest \\\n    docker-common \\\n    docker-latest \\\n    docker-latest-logrotate \\\n    docker-logrotate \\\n    docker-selinux \\\n    docker-engine-selinux \\\n    docker-engine\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s fine if <code>yum<\/code> reports none of these are installed. Anything already in <code>\/var\/lib\/docker\/<\/code> (images, containers, volumes) is preserved.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Set Up the Docker Repository<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">yum install -y yum-utils device-mapper-persistent-data lvm2\nyum-config-manager --add-repo https:\/\/download.docker.com\/linux\/centos\/docker-ce.repo\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Install Docker CE<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">yum install docker-ce\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If prompted to accept a GPG key, verify the fingerprint matches <code>060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35<\/code> before accepting.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">If you have multiple Docker-related repositories enabled, installing without specifying a version always pulls the latest available \u2014 which is usually fine, but worth knowing if you need a specific version for stability reasons (see the next step).<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">4. Install a Specific Version (Optional)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">List available versions:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">yum list docker-ce --showduplicates | sort -r\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then install a specific one:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">yum install docker-ce-&lt;VERSION>\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Start Docker<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl start docker\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. Verify the Installation<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker run hello-world\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Enable Docker to Start on Boot<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl enable docker\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The original guide had <code>systemctl Enable docker<\/code> with a capital &#8220;E&#8221; \u2014 Linux commands are case-sensitive, so <code>systemctl<\/code> doesn&#8217;t recognize <code>Enable<\/code> as a valid subcommand. It must be lowercase.<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Tip:<\/strong> You can combine Steps 5 and 7 into one command: <code>systemctl enable --now docker<\/code>.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">8. Run Docker Without sudo (Optional)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">By default, Docker commands require root\/sudo. To run them as your regular user:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">usermod -aG docker $USER\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Log out and back in for the group change to take effect.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Uninstalling Docker CE<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Remove the package:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">yum remove docker-ce\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To also delete all images, containers, and volumes:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo rm -rf \/var\/lib\/docker\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Any manually edited configuration files aren&#8217;t removed automatically \u2014 delete those separately if needed.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Installing Docker CE on CentOS 7 is a straightforward repository-based install, with one real gotcha: <code>systemctl enable<\/code> must be lowercase, unlike the original guide&#8217;s <code>Enable<\/code>. Keep in mind CentOS 7 itself is past end-of-life, so treat this as maintenance for an existing system rather than a foundation for a new one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why did &#8220;systemctl Enable docker&#8221; fail for me?<\/strong> Linux commands and their subcommands are case-sensitive \u2014 <code>systemctl<\/code> only recognizes the lowercase <code>enable<\/code>, not <code>Enable<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Do I need to restart the server after installing Docker?<\/strong> No \u2014 starting and enabling the service (Steps 5 and 7) is enough; a full restart isn&#8217;t required.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Can I run Docker on CentOS Stream instead of CentOS 7?<\/strong> Yes \u2014 the same repository and install steps work on CentOS Stream, AlmaLinux, and Rocky Linux, since they&#8217;re all RHEL-compatible.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/docker-container-to-image\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Convert a Docker Container to Image<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-save-docker-images-as-a-tar-file\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Save Docker Images as a TAR File<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to Our Technology Experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Containerizing your applications or setting up a Docker-based infrastructure? Our team can help with containerization, orchestration, and ongoing DevOps support.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/contact\">Connect with our technology experts.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post Date: December 26, 2018 Last Updated: October 02, 2026 Introduction This guide explains how to install and uninstall Docker [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1020],"tags":[516,517],"class_list":["post-3144","post","type-post","status-publish","format-standard","hentry","category-containers-kubernetes","tag-docker-installation","tag-docker-uninstallation","psol-cat-containers-kubernetes"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-OI","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=3144"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3144\/revisions"}],"predecessor-version":[{"id":12066,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3144\/revisions\/12066"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=3144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=3144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=3144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}