Install Docker Portainer on CentOS Stream 9 and manage local containers from a private HTTPS dashboard in about ten minutes. You will install Docker Engine from Docker’s RPM repository, preserve Portainer’s configuration in a named volume, and access the interface through an SSH tunnel without publishing its admin port.
Prerequisites
- A 64-bit CentOS Stream 9 VPS with at least 2 GB of RAM and 10 GB of free disk space for images, containers, and Portainer data.
- SSH access as
root, or a regular account with workingsudoprivileges. - Outbound HTTPS access to Docker’s package repository and Docker Hub.
- An SSH client on your workstation. A domain is not required because this guide keeps Portainer on the VPS loopback address.
- A VPSLake Linux VPS if you need a root-access CentOS Stream server.
The commands use sudo for a regular SSH user. If you are logged in as root, remove sudo from each command.
Step 1: Check the release and update CentOS Stream
Confirming the release and architecture prevents you from adding a repository for the wrong Enterprise Linux version.
grep -E '^(PRETTY_NAME|VERSION_ID|PLATFORM_ID)=' /etc/os-release
uname -m
sudo dnf -y upgrade
You should see CentOS Stream 9 and normally x86_64:
PRETTY_NAME="CentOS Stream 9"
VERSION_ID="9"
PLATFORM_ID="platform:el9"
x86_64
CentOS’s centos-extras repository is normally enabled by default and is required by Docker’s supported installation path. If a minimal image has disabled it, you will re-enable the extras-common repository after installing DNF’s repository helper in Step 3. Resolve any DNS, mirror, or GPG signature error before installing Docker.
Step 2: Remove conflicting Docker packages
The distribution may contain older Docker package names that conflict with Docker’s maintained packages, so remove only those old Docker packages before adding the official repository.
sudo dnf remove -y docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
DNF may report that some packages were not installed; that is normal on a fresh VPS. This removal does not erase images, containers, volumes, or networks stored under /var/lib/docker/. Do not remove packages from an existing production host until you know what its current container workloads use.
Step 3: Add Docker’s official CentOS repository
Using Docker’s repository keeps the Engine, containerd, Buildx, and Compose plugin available as a compatible package set. Docker documents this method in its CentOS installation guide.
Install the DNF repository helper and register the CentOS Stream repository:
sudo dnf -y install dnf-plugins-core ca-certificates
sudo dnf config-manager --set-enabled extras-common
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf makecache
Check that DNF can see the stable Docker packages before installing them:
dnf list docker-ce --showduplicates | tail -n 5
The output should contain docker-ce entries from docker-ce-stable. Package versions change over time; do not copy a version from the example output into your command.
Step 4: Install, start, and test Docker Engine
Installing the Compose plugin now gives Portainer a complete Docker host and leaves the standard docker compose command available for later application stacks.
sudo dnf -y install 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 will show an active, enabled service and version values that vary with current releases:
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 test container:
sudo docker run --rm hello-world
The final lines should include Hello from Docker! and Your installation appears to be working correctly.
Step 5: Keep the Portainer service off the public interface
CentOS Stream 9 uses firewalld and SELinux in a typical VPS image. Portainer will bind only to 127.0.0.1, so you do not need to add a public rule for 9443 or the optional Edge Agent port 8000.
Check the current security state without disabling either service:
getenforce
sudo systemctl is-active firewalld
sudo firewall-cmd --state 2>/dev/null || true
Typical output is:
Enforcing
active
running
Keep your existing SSH firewall rule. The tunnel in the next step uses that rule; this guide does not open a new inbound port. If firewalld is active, do not add 9443 because Docker’s loopback binding already prevents direct internet access.
Step 6: Deploy Portainer CE with persistent data
The named volume stores Portainer’s users, settings, and environment records outside the container, so replacing the image does not reset the dashboard. Portainer’s official Docker installation guide documents the socket mount, HTTPS port, and SELinux requirement used here.
Create the volume and launch the LTS image. The --privileged flag is needed for Portainer’s Docker-socket integration when SELinux is enabled; it does not disable SELinux on the host.
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 port 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 creates a self-signed certificate for its first HTTPS connection. A browser warning is expected through the private tunnel; do not reuse that certificate for a public deployment.
Step 7: Open the dashboard through SSH
An SSH local forward carries browser traffic from your workstation to the VPS-only listener, avoiding a public Portainer firewall 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. If Portainer asks for a setup token, retrieve it on the VPS with:
sudo docker logs portainer 2>&1 | grep -m1 'setup_token='
Paste the token into the setup page, create a unique administrator password of at least 12 characters, and choose the automatically detected local Docker environment. The first Portainer account is an administrator, so use a password that is not reused anywhere else.
If port 9443 is already occupied on your workstation, change only the local port:
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 private on 9443.
Verify Docker and Portainer
These checks prove that Docker starts at boot, the Portainer restart policy is set, the listener is bound to loopback, and the HTTPS endpoint answers locally:
sudo systemctl is-active docker
sudo systemctl is-enabled docker
sudo docker inspect --format '{{.HostConfig.RestartPolicy.Name}}' portainer
sudo ss -lntp | grep ':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 browser through the SSH tunnel. 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. Inspect the repository list and rebuild the cache:
sudo dnf repolist --enabled | grep -i docker
sudo dnf makecache
dnf list docker-ce --showduplicates
You should see docker-ce-stable. If it is missing, repeat the dnf config-manager --add-repo command from Step 3 and confirm that the VPS can resolve download.docker.com over HTTPS.
package docker-ce conflicts with ...
An older distribution Docker package is still installed, or DNF has selected a conflicting runtime. Review the installed Docker packages, then rerun the removal command from Step 2 before trying the install again:
rpm -qa | grep -E '^(docker|containerd)' | sort
Do not remove Podman or runc merely because they exist. On an established server, identify which service owns the running containers before changing its runtime.
Portainer restarts or logs an SELinux denial
Portainer needs to reach 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 100 portainer
sudo docker inspect --format '{{.HostConfig.Privileged}}' portainer
The last command should print true. If it prints false, recreate only the Portainer container with the --privileged option, loopback publish, socket mount, and portainer_data volume from Step 6. Do not disable SELinux; the named volume preserves the dashboard data.
bind: address already in use
Another process already owns port 9443 on the VPS. Find it before changing the container mapping:
sudo ss -lntp | grep ':9443'
If you need another port, publish 127.0.0.1:19443:9443, forward 19443:127.0.0.1:19443 in the SSH command, and browse to https://127.0.0.1:19443. Keep the host-side address on loopback.
Hardening
- Keep Portainer on loopback. If several administrators need access, use a reverse proxy with a trusted certificate, strong authentication, and a firewalld rule limited to the required HTTPS sources.
- Treat the Docker socket and Portainer administrator account as root-equivalent access. Limit both to trusted operators and avoid publishing Docker’s unauthenticated TCP API on port 2375.
- Back up the
portainer_datavolume before changing the image tag, and monitor free disk space under Docker’s data directory. - Review your SSH exposure with VPSLake’s SSH hardening generator before relying on the tunnel for administration.
FAQ
Does CentOS Stream 9 use dnf or yum for Docker?
Use dnf. CentOS Stream 9 is an Enterprise Linux 9 release, and Docker’s current CentOS instructions use DNF’s repository plugin and the CentOS RPM repository.
Do I need to open 9443 in firewalld?
No. The Docker publish option binds 9443 to 127.0.0.1, not the VPS’s public address. The SSH tunnel reaches that private listener, so no new inbound Portainer rule is required.
Why is port 8000 missing from the Docker command?
Port 8000 is Portainer’s optional tunnel service for Edge Agent features. A Portainer Server managing the Docker Engine on the same VPS through /var/run/docker.sock does not need it, so leaving it unpublished reduces exposure.
Can I update Portainer without losing settings?
Yes. Keep the portainer_data volume, back it up, and replace only the container with the intended LTS image. The volume contains the Portainer database and environment configuration; deleting it would remove those settings.