Install docker portainer on Rocky Linux 8 and finish with a working Docker Engine plus a persistent Portainer CE dashboard in about ten minutes. The setup keeps Portainer’s HTTPS listener private and lets you open it from your computer through SSH.
Prerequisites
- A 64-bit Rocky Linux 8 VPS with at least 2 GB of RAM and 10 GB of free disk space for Docker images, containers, and Portainer data.
- SSH access as
root, or a regular account with workingsudoprivileges. - Outbound HTTPS access to Docker’s RPM repository and Docker Hub.
- An SSH client on your local computer. You do not need a domain for the loopback-only dashboard in this guide.
- A VPSLake Linux VPS if you need a root-access server for this Docker deployment.
The commands use sudo for a non-root account. If you are logged in as root, remove sudo from each command. Rocky Linux 8 uses DNF, firewalld, and usually enforcing SELinux; this guide keeps those defaults in place.
Step 1: Confirm Rocky Linux 8 and update the VPS
Checking the release and architecture first prevents you from adding an Enterprise Linux repository for the wrong system.
grep -E '^(PRETTY_NAME|VERSION_ID|PLATFORM_ID|ID_LIKE)=' /etc/os-release
uname -m
sudo dnf -y upgrade
The version should identify Rocky Linux 8 and the architecture should normally be x86_64:
PRETTY_NAME="Rocky Linux 8.x (Green Obsidian)"
VERSION_ID="8.x"
PLATFORM_ID="platform:el8"
ID_LIKE="rhel centos fedora"
x86_64
The minor release and kernel version will vary. Resolve any repository, DNS, or GPG-signature error before continuing.
Step 2: Remove conflicting packages and add Docker’s repository
Docker’s Engine packages include the runtime components they expect, so an older distribution Docker stack can prevent DNF from resolving dependencies.
On a new VPS, remove only the common conflicting package names:
sudo dnf remove -y docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine \
podman \
runc
DNF may report that some packages are not installed. It does not erase images, containers, or volumes under /var/lib/docker/, but do not remove an active runtime from a production host until you have checked its workloads.
Docker’s official RHEL installation guide uses the matching repository for the RHEL-compatible EL8 layout used by Rocky Linux. Install the repository helper, register it, and refresh metadata:
sudo dnf install -y dnf-plugins-core ca-certificates
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
sudo dnf makecache
Check that the repository offers an EL8 Docker package before installing:
dnf list --showduplicates docker-ce | tail -n 5
You should see docker-ce entries from Docker’s stable repository. The exact version changes as new releases arrive.
Step 3: Install and test Docker Engine
Installing the Compose plugin with Docker gives Portainer a complete Engine host and leaves docker compose available for later application stacks.
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl enable --now docker
sudo systemctl is-active docker
sudo systemctl is-enabled docker
sudo docker version --format 'Client {{.Client.Version}} / Server {{.Server.Version}}'
sudo docker compose version
Expected output has an active, enabled daemon and version values that vary by release:
active
enabled
Client x.y.z / Server x.y.z
Docker Compose version v2.x.y
Run Docker’s disposable test image. It checks daemon access, registry connectivity, and the container runtime, then removes the stopped container:
sudo docker run --rm hello-world
The final output should include Hello from Docker! and Your installation appears to be working correctly.
Step 4: Check firewalld and SELinux
Portainer will be published only on 127.0.0.1, so you do not need to open a public rule for its HTTPS port or its optional Edge Agent port.
Inspect the host security services without changing them:
getenforce
sudo systemctl is-active firewalld
sudo firewall-cmd --get-active-zones
Typical output looks like this:
Enforcing
active
public
interfaces: eth0
Keep the existing SSH firewall rule because the next step uses SSH. Do not add port 9443 to a public firewalld zone: a loopback binding prevents outside connections even when Docker manages its own forwarding rules.
Step 5: Deploy Portainer CE with private HTTPS
The named volume keeps Portainer’s users, settings, and environment records separate from the container, so recreating the container does not reset the dashboard. Portainer’s official Docker installation guide uses the same Docker socket and data-volume arrangement.
Because Rocky Linux commonly runs SELinux in enforcing mode, --privileged is required for Portainer’s local Docker-socket integration. This does not disable SELinux; the host policy remains enabled.
Create the volume and start the current long-term-support image. Port 8000 is omitted because it is only needed for Edge Agent tunnel features, not for a Portainer Server managing Docker on this VPS:
sudo docker volume create portainer_data
sudo docker run -d \
--name portainer \
--restart=always \
--privileged \
--publish 127.0.0.1:9443:9443 \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume portainer_data:/data \
portainer/portainer-ce:lts
Docker prints a long container ID. Confirm that the container is running and that the host-side listener is private:
sudo docker ps --filter name=portainer --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}'
NAMES IMAGE STATUS PORTS
portainer portainer/portainer-ce:lts Up ... 127.0.0.1:9443->9443/tcp
Portainer generates a self-signed certificate for its first HTTPS connection. A browser warning is expected when you access it through the private tunnel.
Step 6: Open Portainer through an SSH tunnel
The SSH local forward carries browser traffic to the VPS listener without exposing Portainer on the public address or adding a firewalld exception.
Run this command on your local computer, not in the VPS shell. Replace the uppercase placeholders and leave the terminal open:
ssh -N -L 9443:127.0.0.1:9443 YOUR_SSH_USER@SERVER_IP
Open https://127.0.0.1:9443 in your browser. Continue past the self-signed certificate warning only when the address is exactly 127.0.0.1, create a unique administrator password of at least 12 characters, and choose the automatically detected local Docker environment.
If port 9443 is already in use on your computer, change only the local side of the tunnel:
ssh -N -L 19443:127.0.0.1:9443 YOUR_SSH_USER@SERVER_IP
Then browse to https://127.0.0.1:19443. The VPS-side listener remains on private port 9443.
Verify Docker and Portainer
Run these checks on the VPS to prove that Docker starts at boot, Portainer restarts automatically, and its HTTPS service is reachable only from the host:
sudo systemctl is-active docker
sudo systemctl is-enabled docker
sudo docker inspect --format '{{.HostConfig.RestartPolicy.Name}}' portainer
sudo ss -lntp | grep '127.0.0.1:9443'
curl --insecure --silent --show-error --output /dev/null --write-out '%{http_code}\n' https://127.0.0.1:9443
Expected results include:
active
enabled
always
LISTEN ... 127.0.0.1:9443 ...
200
Refresh the tunneled browser page. You should see Portainer’s setup page or dashboard, and the local Docker environment should be available after setup.
Troubleshooting
No match for argument: docker-ce
DNF cannot see Docker’s repository, or its metadata is stale. Confirm that the RHEL repository file is enabled and refresh the cache:
sudo dnf repolist --enabled | grep -i docker
sudo dnf makecache
dnf list --showduplicates docker-ce
The output should contain Docker’s stable repository and an EL8 package. If it does not, repeat the dnf config-manager --add-repo command from Step 2 and confirm that the VPS can resolve download.docker.com over HTTPS.
package docker-ce conflicts with ...
An older Docker package, Podman runtime, or standalone runc installation is still present. On a fresh VPS, rerun the removal command from Step 2 and retry the install; on an established host, identify which service owns the containers before changing its runtime.
rpm -qa | grep -E '^(docker|containerd|podman|runc)' | sort
Do not remove packages blindly from a host that already runs important workloads.
Portainer restarts or logs an SELinux denial
Portainer needs access to the Docker socket, and SELinux can block that access unless the container is privileged. Inspect the host mode, recent logs, and the container setting:
getenforce
sudo docker logs --tail 80 portainer
sudo docker inspect --format '{{.HostConfig.Privileged}}' portainer
The last command should print true. If it prints false, recreate only the Portainer container with --privileged, the loopback publish option, the socket mount, and the existing portainer_data volume. Do not disable SELinux.
The browser cannot connect to 127.0.0.1:9443
The tunnel must run on your workstation and remain open. Start it again, then check the container and listener on the VPS:
sudo docker ps --filter name=portainer
sudo ss -lntp | grep ':9443'
The container’s port column should show 127.0.0.1:9443->9443/tcp. If the container is stopped, inspect sudo docker logs portainer; do not browse to https://SERVER_IP:9443 because this setup intentionally keeps that address private.
Hardening
- Keep Portainer on loopback. If you later need shared access, place it behind a reverse proxy with a trusted certificate, authentication, and a narrowly scoped firewalld rule.
- Treat the Docker socket and Portainer administrator account as root-equivalent access. Do not expose Docker’s unauthenticated TCP API on port 2375.
- Back up the
portainer_datavolume before replacing the image, and monitor free space under Docker’s data directory. - Review SSH exposure with VPSLake’s SSH hardening generator before relying on the tunnel for administration.
FAQ
Why does Rocky Linux 8 use Docker’s RHEL repository?
Rocky Linux follows the RHEL-compatible Enterprise Linux package layout. Docker publishes a RHEL 8 repository path, so the RHEL repo file is the appropriate current source for Docker packages on Rocky 8; do not mix it with Ubuntu APT instructions.
Do I need to open port 9443 in firewalld?
No. Docker binds the host side to 127.0.0.1, which is not the VPS’s public interface. The SSH tunnel reaches that local listener, so no new inbound Portainer rule is needed.
What is Portainer port 8000 for?
Port 8000 is an optional tunnel used by Portainer Edge Agent features. A local Portainer Server using /var/run/docker.sock to manage Docker on the same VPS can leave that port unpublished.
Can I update Portainer without losing its settings?
Yes. Keep the portainer_data volume, back it up, and replace only the Portainer container during a planned upgrade. The volume contains the Portainer database and configuration, while Docker application containers remain separate.