{"id":1097,"date":"2026-11-16T09:00:00","date_gmt":"2026-11-16T09:00:00","guid":{"rendered":"https:\/\/vpslake.com\/blog\/?p=1097"},"modified":"2026-11-16T09:00:00","modified_gmt":"2026-11-16T09:00:00","slug":"install-docker-portainer-rocky-linux-9","status":"publish","type":"post","link":"https:\/\/vpslake.com\/blog\/2026\/11\/16\/install-docker-portainer-rocky-linux-9\/","title":{"rendered":"How to Install Docker Portainer on Rocky Linux 9"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This guide shows you how to install docker portainer on rocky linux 9 and finish with a working Docker Engine plus a private Portainer CE dashboard in about ten minutes. The setup keeps Portainer off the public network, preserves its data, and gives you checks for the errors most fresh VPS installations encounter.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>A 64-bit Rocky Linux 9 VPS with at least 2 GB of RAM and 10 GB of free disk space for Docker images, containers, and Portainer data.<\/li>\n\n\n<li>SSH access as <code>root<\/code>, or a normal account with working <code>sudo<\/code> privileges.<\/li>\n\n\n<li>Outbound HTTPS access to Docker Hub and Docker&#8217;s package repository.<\/li>\n\n\n<li>An SSH client on your own computer for a local tunnel. You do not need a domain for this private setup; a domain is only needed if you later publish Portainer behind a reverse proxy.<\/li>\n\n\n<li>A <a href=\"https:\/\/vpslake.com\/buy-vps\">VPSLake Linux VPS<\/a> with root access if you need a Rocky Linux server for Docker workloads.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The commands assume a regular sudo-enabled account. If you are logged in as <code>root<\/code>, remove <code>sudo<\/code>. Rocky Linux 9 uses DNF, firewalld, and SELinux, so do not substitute Ubuntu&#8217;s APT\/UFW commands.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Confirm Rocky Linux 9 and update the host<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Checking the release and CPU architecture first prevents a repository for another Enterprise Linux version from being added to the VPS.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>. \/etc\/os-release &amp;&amp; printf 'ID=%s\\nVERSION_ID=%s\\nVERSION_CODENAME=%s\\n' \"$ID\" \"$VERSION_ID\" \"${VERSION_CODENAME:-not-set}\"\nuname -m\nsudo dnf -y upgrade<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first lines should identify Rocky Linux 9, and most VPSs report <code>x86_64<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ID=rocky\nVERSION_ID=\"9.x\"\nVERSION_CODENAME=not-set\nx86_64<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The minor release changes as Rocky publishes updates. If DNF reports DNS, mirror, or signature errors, fix those before installing Docker.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Remove conflicting packages and add Docker&#8217;s Rocky repository<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Rocky may include Podman or an older Docker package; Docker CE supplies its own container runtime and can conflict with those packages on a new host.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On a fresh VPS, remove the packages that Docker identifies as conflicts, then add Docker&#8217;s Rocky repository:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf remove -y docker \\\n  docker-client \\\n  docker-client-latest \\\n  docker-common \\\n  docker-latest \\\n  docker-latest-logrotate \\\n  docker-logrotate \\\n  docker-engine \\\n  podman \\\n  runc\nsudo dnf install -y dnf-plugins-core ca-certificates\nsudo dnf config-manager --add-repo https:\/\/download.docker.com\/linux\/rocky\/docker-ce.repo\nsudo dnf makecache<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">DNF may say that some packages were not installed; that is normal. Do not remove Podman or <code>runc<\/code> from a server already running production containers until you have planned a runtime migration. Removing packages does not automatically delete Docker data in <code>\/var\/lib\/docker\/<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Confirm that DNF can see the Rocky 9 packages before you install them:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf list docker-ce --showduplicates | tail -n 5<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You should see <code>docker-ce<\/code> entries from Docker&#8217;s stable repository with an <code>.el9<\/code> package suffix. The exact version changes as Docker publishes updates.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Install, start, and test Docker Engine<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Installing the Compose plugin with the Engine gives Portainer a complete Docker host and leaves <code>docker compose<\/code> available for later application stacks.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin\nsudo systemctl enable --now docker\nsudo systemctl is-active docker\nsudo systemctl is-enabled docker\nsudo docker version --format 'Client {{.Client.Version}} \/ Server {{.Server.Version}}'\nsudo docker compose version<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output shows an active, enabled service; version numbers vary with current releases:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>active\nenabled\nClient 29.x.y \/ Server 29.x.y\nDocker Compose version v2.x.y<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run Docker&#8217;s disposable test image to verify the daemon, registry connection, and runtime:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo docker run --rm hello-world<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The final output should include <code>Hello from Docker!<\/code> and <code>Your installation appears to be working correctly.<\/code> The <code>--rm<\/code> flag removes the stopped test container afterward.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Check Rocky&#8217;s firewall and SELinux state<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Portainer will bind to loopback, so you do not need a public firewall rule for its web port; checking Rocky&#8217;s security services now helps prevent an accidental SSH lockout or an unexplained container denial.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>getenforce\nsudo systemctl is-active firewalld\nsudo firewall-cmd --state\nsudo firewall-cmd --query-service=ssh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On a typical configured Rocky VPS, the results include:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Enforcing\nactive\nrunning\nyes<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Keep SELinux enabled. Keep the existing SSH rule in place, and do not add 9443 or 8000 to firewalld for this guide: both Portainer ports remain unpublished to the public interface. If SSH is not allowed, correct that through your provider console before disconnecting your current session.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Deploy Portainer CE with a private HTTPS listener<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A named volume keeps Portainer users, settings, and environment records outside the container, while the loopback binding prevents direct internet access to the dashboard. Portainer&#8217;s <a href=\"https:\/\/docs.portainer.io\/start\/install-ce\/server\/docker\/linux\" target=\"_blank\" rel=\"noopener\">official Docker installation guide<\/a> uses the Docker socket and <code>\/data<\/code> volume; its Linux guidance calls for <code>--privileged<\/code> when SELinux is enabled.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create the volume and start the current long-term-support image:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo docker volume create portainer_data\nsudo docker run -d \\\n  --name portainer \\\n  --restart=always \\\n  --privileged \\\n  --publish 127.0.0.1:9443:9443 \\\n  --volume \/var\/run\/docker.sock:\/var\/run\/docker.sock \\\n  --volume portainer_data:\/data \\\n  portainer\/portainer-ce:lts<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Docker prints a container ID. Verify that Portainer is running and that the host-side listener is private:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo docker ps --filter name=portainer --format 'table {{.Names}}\\t{{.Image}}\\t{{.Status}}\\t{{.Ports}}'<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>NAMES      IMAGE                       STATUS       PORTS\nportainer  portainer\/portainer-ce:lts Up ...        127.0.0.1:9443-&gt;9443\/tcp<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Portainer generates a self-signed certificate for the first HTTPS connection. A browser warning is expected when you connect through the private tunnel. Port 8000 is optional for Edge Agent features and is intentionally not published here.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6: Open Portainer through an SSH tunnel<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The tunnel carries your browser traffic to the loopback-only listener without exposing Portainer in Rocky&#8217;s firewall.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run this command on your local computer, not inside the VPS shell, and leave the terminal open:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -N -L 9443:127.0.0.1:9443 YOUR_SSH_USER@SERVER_IP<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>YOUR_SSH_USER<\/code> with the VPS login name and <code>SERVER_IP<\/code> with its public address. The command stays open while it forwards your local port.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open <code>https:\/\/127.0.0.1:9443<\/code> in your browser. Accept the certificate warning only when the address is exactly <code>127.0.0.1<\/code>, then create a strong, unique administrator password and select the local Docker environment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">New Portainer installations may request a setup token before the first administrator is created. If the page asks for one, retrieve it on the VPS:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo docker logs portainer 2&gt;&amp;1 | grep -m1 'setup_token='<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If port 9443 is already occupied on your computer, change only the local side of the forward:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -N -L 19443:127.0.0.1:9443 YOUR_SSH_USER@SERVER_IP<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then browse to <code>https:\/\/127.0.0.1:19443<\/code>. The VPS listener remains on loopback port 9443, so no new firewalld rule is needed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Verify Docker and Portainer<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Run these checks on the VPS to prove that Docker starts at boot, Portainer restarts automatically, SELinux-aware privilege is enabled, and HTTPS answers locally:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl is-active docker\nsudo systemctl is-enabled docker\nsudo docker inspect --format '{{.HostConfig.RestartPolicy.Name}}' portainer\nsudo docker inspect --format '{{.HostConfig.Privileged}}' portainer\nsudo ss -lntp | grep '127.0.0.1:9443'\ncurl --insecure --head --max-time 10 https:\/\/127.0.0.1:9443<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected results include:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>active\nenabled\nalways\ntrue\nLISTEN ... 127.0.0.1:9443 ...\nHTTP\/1.1 200 OK<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Refresh the tunneled browser page. You should see Portainer&#8217;s setup page or dashboard, and the local Docker environment should be available after setup.<\/p>\n\n\n\n<aside class=\"vl-element vl-cta-banner\" aria-label=\"Run Docker and Portainer\">\n\t<div class=\"vl-cta-banner__content\">\n\t\t<p class=\"vl-cta-banner__eyebrow\">Rocky Linux VPS<\/p>\n\t\t<h3 class=\"vl-cta-banner__title\">Run Docker and Portainer<\/h3>\n\t\t<p class=\"vl-cta-banner__text\">Get a root-access Rocky Linux VPS for a private Docker management dashboard.<\/p>\n\t<\/div>\n\t<a class=\"vl-cta-banner__button\" href=\"\/buy-vps\" aria-label=\"View Linux VPS plans\">View Linux VPS plans<\/a>\n<\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><code>No match for argument: docker-ce<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">DNF cannot see Docker&#8217;s Rocky repository, or its metadata is stale. Check the enabled repositories and rebuild the cache:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf repolist --enabled | grep -i docker\nsudo dnf makecache\ndnf list docker-ce --showduplicates<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The repository list should include Docker&#8217;s stable channel. If it is missing, repeat the Rocky repository command from Step 2 and confirm that the VPS can resolve <code>download.docker.com<\/code> over HTTPS. Do not mix in an Ubuntu or unrelated Enterprise Linux repository.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>package docker-ce conflicts with podman<\/code> or <code>runc<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Rocky&#8217;s default container tools are still installed. On a new VPS, repeat the removal command in Step 2 and retry the Docker installation. On an established host, do not remove the runtime blindly: identify the services using it and schedule a migration first.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Portainer logs an SELinux denial or immediately restarts<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Portainer must reach the Docker socket, and SELinux can block that access without privileged container mode. Inspect the host mode, recent logs, and container setting:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>getenforce\nsudo docker logs --tail 100 portainer\nsudo docker inspect --format '{{.HostConfig.Privileged}}' portainer<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The last command should print <code>true<\/code>. If it prints <code>false<\/code>, recreate only the Portainer container with the <code>--privileged<\/code> option, loopback publish, socket mount, and <code>portainer_data<\/code> volume from Step 5. Do not disable SELinux; the named volume keeps the dashboard data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The browser cannot connect to <code>127.0.0.1:9443<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The tunnel may be closed, the local port may be busy, or the container may not be listening. Start the tunnel again and keep it open:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -N -L 9443:127.0.0.1:9443 YOUR_SSH_USER@SERVER_IP<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On the VPS, check the binding and logs:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ss -lntp | grep '127.0.0.1:9443'\nsudo docker ps --filter name=portainer\nsudo docker logs --tail 50 portainer<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Do not browse to <code>https:\/\/SERVER_IP:9443<\/code>; this setup deliberately does not publish Portainer on the public address.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Hardening<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>Keep Portainer on loopback. If you later need shared access, place it behind a reverse proxy with a trusted certificate, strong authentication, and a narrowly scoped firewalld rule.<\/li>\n\n\n<li>Treat <code>\/var\/run\/docker.sock<\/code>, the <code>docker<\/code> group, and the Portainer administrator account as root-equivalent access. Never expose Docker&#8217;s unauthenticated TCP API on port 2375.<\/li>\n\n\n<li>Back up the <code>portainer_data<\/code> volume before changing the image tag or rebuilding the container.<\/li>\n\n\n<li>Review SSH settings with VPSLake&#8217;s <a href=\"https:\/\/vpslake.com\/sshd-hardening-generator\">SSH hardening generator<\/a> before relying on the tunnel for administration.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Does Rocky Linux 9 use UFW for Docker firewall rules?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. Rocky Linux 9 uses firewalld, managed with <code>firewall-cmd<\/code>. This guide does not open a Portainer rule because Docker publishes 9443 only on <code>127.0.0.1<\/code>; the SSH tunnel uses your existing SSH access.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why is <code>--privileged<\/code> needed on Rocky Linux 9?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Portainer needs to communicate with the root-run Docker daemon through the mounted Unix socket. Portainer documents privileged mode for Docker hosts that keep SELinux enabled, so the command grants the container the required access without disabling the host policy.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Do I need a domain name for Portainer?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. The SSH tunnel makes the private dashboard available at <code>https:\/\/127.0.0.1:9443<\/code> on your computer. Add a domain only if you later choose a public reverse-proxy deployment with trusted TLS.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What does <code>portainer_data<\/code> protect?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The volume stores Portainer&#8217;s database, users, settings, and environment configuration separately from the container. You can replace the Portainer container during a planned upgrade without removing that data.<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"Does Rocky Linux 9 use UFW for Docker firewall rules?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. Rocky Linux 9 uses firewalld, managed with `firewall-cmd`. This guide does not open a Portainer rule because Docker publishes 9443 only on `127.0.0.1`; the SSH tunnel uses your existing SSH access.\"}}, {\"@type\": \"Question\", \"name\": \"Why is `--privileged` needed on Rocky Linux 9?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Portainer needs to communicate with the root-run Docker daemon through the mounted Unix socket. Portainer documents privileged mode for Docker hosts that keep SELinux enabled, so the command grants the container the required access without disabling the host policy.\"}}, {\"@type\": \"Question\", \"name\": \"Do I need a domain name for Portainer?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. The SSH tunnel makes the private dashboard available at `https:\/\/127.0.0.1:9443` on your computer. Add a domain only if you later choose a public reverse-proxy deployment with trusted TLS.\"}}, {\"@type\": \"Question\", \"name\": \"What does `portainer_data` protect?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"The volume stores Portainer's database, users, settings, and environment configuration separately from the container. You can replace the Portainer container during a planned upgrade without removing that data.\"}}]}<\/script>\n\n","protected":false},"excerpt":{"rendered":"Install Docker Portainer on Rocky Linux 9 with Docker CE, SELinux-aware settings, private HTTPS access, SSH tunneling, verification, and fixes.","protected":false},"author":1,"featured_media":1098,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","footnotes":""},"categories":[5,9],"tags":[119,118,137,100],"class_list":["post-1097","post","type-post","status-publish","format-standard","has-post-thumbnail","category-guides","category-vps-hosting","tag-containers","tag-docker","tag-portainer","tag-rocky-linux-9","cs-entry"],"_links":{"self":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1097","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/comments?post=1097"}],"version-history":[{"count":1,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1097\/revisions"}],"predecessor-version":[{"id":4062,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1097\/revisions\/4062"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media\/1098"}],"wp:attachment":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media?parent=1097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/categories?post=1097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/tags?post=1097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}