How to Install Portainer for Docker Management on RHEL 7

Portainer is an open-source container management UI that puts a graphical interface in front of Docker, Swarm, and Kubernetes. Instead of memorising dozens of docker subcommands, Portainer lets you inspect containers, manage images and volumes, view real-time logs, open an in-browser terminal, and deploy stacks — all from a web browser. This tutorial covers installing Portainer CE on RHEL 7, performing the initial admin setup, exploring the local Docker environment through the UI, and optionally deploying the Portainer Agent so you can manage remote Docker hosts from a single Portainer instance.

Prerequisites

  • RHEL 7 server with Docker CE installed and the docker service enabled
  • Root or sudo access
  • Port 9443 (HTTPS) or 9000 (HTTP) accessible from your browser
  • At least 512 MB free RAM

Step 1: Open the Required Firewall Ports

Portainer CE listens on port 9443 for HTTPS and 9000 for HTTP. Open the port you intend to use:

# HTTPS (recommended)
sudo firewall-cmd --permanent --add-port=9443/tcp

# Also open 8000 if you will connect Portainer Agents
sudo firewall-cmd --permanent --add-port=8000/tcp

sudo firewall-cmd --reload

Step 2: Create the Portainer Data Volume

Portainer stores its configuration, user accounts, and stack definitions in a Docker named volume. Creating the volume explicitly before running the container makes it easy to back up or migrate:

sudo docker volume create portainer_data

Confirm the volume was created:

sudo docker volume ls | grep portainer_data

To see where Docker stores the volume data on the host (useful for backups):

sudo docker volume inspect portainer_data 
  --format '{{ .Mountpoint }}'

Step 3: Run the Portainer CE Container

Portainer needs access to the Docker socket (/var/run/docker.sock) to communicate with the local Docker daemon. Mount the socket and the data volume:

sudo docker run -d 
  --name portainer 
  --restart=always 
  -p 8000:8000 
  -p 9443:9443 
  -v /var/run/docker.sock:/var/run/docker.sock 
  -v portainer_data:/data 
  portainer/portainer-ce:latest

If you prefer HTTP on port 9000 (not recommended outside a private network):

sudo docker run -d 
  --name portainer 
  --restart=always 
  -p 9000:9000 
  -v /var/run/docker.sock:/var/run/docker.sock 
  -v portainer_data:/data 
  portainer/portainer-ce:latest

Verify the container started correctly:

sudo docker ps | grep portainer
sudo docker logs portainer 2>&1 | tail -20

Step 4: Initial Admin Setup

Open a browser and navigate to https://<server-ip>:9443. On the first visit, Portainer presents a setup screen asking you to create the initial admin account:

  1. Enter a username (default: admin)
  2. Enter a strong password of at least 12 characters
  3. Click Create user

You will be prompted to choose an environment type. Select Get Started to connect to the local Docker socket, or select Add Environments to configure remote hosts.

Important: Portainer requires the initial admin account to be created within 5 minutes of the first container start. If you miss this window, the container logs a timeout message and you must delete the data volume and re-create the container:

sudo docker stop portainer && sudo docker rm portainer
sudo docker volume rm portainer_data
sudo docker volume create portainer_data
# Re-run the docker run command above

Step 5: Connecting to the Local Docker Environment

After initial setup, Portainer automatically detects and connects to the local Docker socket as a local environment named local. Click on local in the Environments list to enter the dashboard for that host. You will see:

  • Containers — total, running, stopped, and paused counts
  • Images — total images, total size on disk
  • Volumes — named volumes
  • Networks — Docker networks
  • Stacks — Docker Compose stacks managed by Portainer

Step 6: Managing Containers via the UI

From the Containers list you can perform all common operations:

  • Start / Stop / Restart / Kill / Remove — select one or more containers and use the action buttons at the top
  • Logs — click a container name then select the Logs tab; supports live follow and line-count controls
  • Console — open an in-browser terminal into the container (equivalent to docker exec -it <id> /bin/bash)
  • Inspect — view the full JSON inspect output
  • Stats — real-time CPU, memory, and network graphs

Step 7: Deploying a Stack from the UI

Portainer can deploy Docker Compose stacks directly. Navigate to Stacks → Add stack:

  1. Enter a stack name (e.g., mywebapp)
  2. Paste a docker-compose.yml into the web editor, or provide a Git repository URL
  3. Set environment variables in the Env section at the bottom
  4. Click Deploy the stack

Portainer tracks the stack and lets you update, redeploy, or remove it through the same interface.

Step 8: Managing Images and Volumes

Under Images you can pull new images by entering their full name (e.g., nginx:1.25) and clicking Pull the image. You can also remove unused images to free disk space. The Volumes section shows all named volumes, their mount points, and which containers are using them. You can browse volume contents and remove orphaned volumes safely.

Step 9: Install the Portainer Agent for Remote Hosts

To manage Docker on other RHEL 7 servers from the same Portainer UI, deploy the Portainer Agent on each remote host:

# Run this on the REMOTE Docker host (not the Portainer server)
sudo docker run -d 
  --name portainer_agent 
  --restart=always 
  -p 9001:9001 
  -v /var/run/docker.sock:/var/run/docker.sock 
  -v /var/lib/docker/volumes:/var/lib/docker/volumes 
  portainer/agent:latest

Open port 9001 on the remote host:

sudo firewall-cmd --permanent --add-port=9001/tcp
sudo firewall-cmd --reload

Back in the Portainer UI on your main server, go to Settings → Environments → Add environment. Choose Agent, enter the remote host IP and port 9001, and click Add environment. You can now switch between environments from the environment dropdown at the top left.

Step 10: Updating Portainer

To update to a newer Portainer CE release, stop and remove the existing container (the data volume is preserved), pull the new image, and re-run:

sudo docker stop portainer
sudo docker rm portainer
sudo docker pull portainer/portainer-ce:latest

sudo docker run -d 
  --name portainer 
  --restart=always 
  -p 8000:8000 
  -p 9443:9443 
  -v /var/run/docker.sock:/var/run/docker.sock 
  -v portainer_data:/data 
  portainer/portainer-ce:latest

Conclusion

Portainer CE transforms Docker on RHEL 7 from a purely command-line experience into an accessible, browser-based management platform. By mounting the Docker socket and persisting configuration in a named volume, the installation is lightweight and easy to maintain. Whether you are an administrator who prefers a visual workflow, a developer who wants a quick way to inspect container logs, or a team lead who needs to give non-technical colleagues visibility into running services, Portainer delivers all of this with a single docker run command. Combined with the Portainer Agent, you can extend the same UI to manage your entire fleet of RHEL 7 Docker hosts from one place.