How To Install Portainer on Rocky Linux

Install Portainer on Rocky Linux

Portainer is a lightweight, cross-platform management tool designed specifically for Docker environments. Think of it as your Docker command center – instead of typing complex command-line instructions, you get a clean, intuitive web interface that makes container management feel like a breeze.

Key Features of Portainer

Portainer isn’t just another management tool; it’s packed with features that make container orchestration significantly easier:

  • Visual Container Management: View, start, stop, and restart containers with simple clicks
  • Image Management: Pull, push, and manage Docker images from multiple registries
  • Network Configuration: Create and manage Docker networks through an intuitive interface
  • Volume Management: Handle persistent storage with drag-and-drop simplicity
  • User Access Control: Set up role-based permissions for team collaboration
  • Template Gallery: Deploy applications quickly using pre-configured templates
  • Multi-Environment Support: Manage local Docker, Docker Swarm, and Kubernetes clusters

Why Use Portainer for Container Management?

If you’ve ever felt overwhelmed by Docker’s command-line interface, you’re not alone. Portainer bridges the gap between powerful functionality and user-friendly design. It reduces the learning curve for newcomers while providing advanced features that experienced users appreciate.

According to recent surveys, over 65% of developers prefer GUI-based tools for container management, primarily because they reduce human error and speed up deployment processes. Portainer delivers exactly that – a visual approach to container management that doesn’t sacrifice functionality.

What is Rocky Linux?

Rocky Linux emerged as a community-driven alternative to CentOS, maintaining the same enterprise-grade stability and security that made CentOS popular among system administrators worldwide.

Rocky Linux vs CentOS

When Red Hat announced changes to CentOS’s release cycle, the community needed a reliable alternative. Rocky Linux stepped up to fill this gap:

  • Upstream Compatibility: Rocky Linux maintains 1:1 binary compatibility with Red Hat Enterprise Linux
  • Community Governance: Developed and maintained by the community, for the community
  • Long-term Support: Provides predictable, long-term release cycles
  • Enterprise Features: Includes all the enterprise-grade features you’d expect from an RHEL clone

Why Choose Rocky Linux for Docker Containers?

Rocky Linux offers several advantages for containerized environments:

  • Stability: Rock-solid foundation for production workloads
  • Security: Regular security updates and patches
  • Performance: Optimized for server workloads
  • Package Management: DNF package manager with extensive repositories
  • SELinux Integration: Built-in security frameworks that work well with containers

Prerequisites for Installing Portainer on Rocky Linux

Before diving into the installation process, let’s ensure your system meets all requirements and has the necessary components in place.

System Requirements

Your Rocky Linux system should meet these minimum specifications:

  • CPU: 1 core (2+ cores recommended for production)
  • RAM: 1GB minimum (4GB+ recommended)
  • Storage: 10GB available disk space
  • Network: Internet connectivity for downloading packages
  • User Privileges: Root access or sudo privileges

Required Software and Dependencies

You’ll need these components before installing Portainer:

  • Rocky Linux 8 or 9: Ensure your system is up to date
  • Docker Engine: The container runtime platform
  • curl or wget: For downloading packages (usually pre-installed)
  • Text Editor: nano, vim, or your preferred editor

Installing Docker on Rocky Linux

Docker serves as the foundation for Portainer, so we’ll install it first. The process involves adding the official Docker repository and installing the engine.

Adding Docker Repository

First, update your system packages and install required dependencies:

sudo dnf update -y
sudo dnf install -y dnf-utils device-mapper-persistent-data lvm2

Next, add the official Docker repository:

sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Installing Docker Engine

Install Docker Engine, CLI, and containerd:

sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

This command installs the complete Docker ecosystem, including the newer Docker Compose plugin that integrates seamlessly with Docker CLI.

Starting and Enabling Docker Service

Start the Docker service and enable it to start automatically on boot:

sudo systemctl start docker
sudo systemctl enable docker

Verify that Docker is running correctly:

sudo docker --version
sudo docker run hello-world

If you see the “Hello from Docker!” message, congratulations – Docker is working perfectly!

Add your user to the docker group to run Docker commands without sudo:

sudo usermod -aG docker $USER

Log out and log back in for the group changes to take effect.

Installing Portainer on Rocky Linux

Now comes the exciting part – installing Portainer itself. The process is straightforward and involves creating a persistent volume and running the Portainer container.

Creating Portainer Volume

First, create a Docker volume to persist Portainer data:

docker volume create portainer_data

This volume ensures that your Portainer configuration, users, and settings persist even if you update or restart the container.

Running Portainer Container

Launch Portainer using the official Docker image:

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

Let’s break down this command:

  • -d: Run in detached mode (background)
  • -p 8000:8000: Expose port 8000 for TCP tunnel server
  • -p 9443:9443: Expose port 9443 for HTTPS web interface
  • --name portainer: Assign a friendly name to the container
  • --restart=always: Automatically restart the container if it stops
  • -v /var/run/docker.sock:/var/run/docker.sock: Mount Docker socket for container management
  • -v portainer_data:/data: Mount the persistent volume for data storage

Accessing Portainer Web Interface

Open your web browser and navigate to:

https://your-server-ip:9443

If you’re running this locally, use:

https://localhost:9443

You might see a security warning about the self-signed certificate – this is normal. Click “Advanced” and proceed to the site.

Initial Portainer Setup and Configuration

The first time you access Portainer, you’ll go through a setup wizard that establishes your admin account and connects to your Docker environment.

Creating Admin Account

On the initial setup page, you’ll need to:

  1. Set Admin Username: Choose a memorable username (default is ‘admin’)
  2. Create Strong Password: Use at least 12 characters with mixed case, numbers, and symbols
  3. Confirm Password: Re-enter your password to confirm

Remember these credentials – you’ll need them every time you access Portainer. The system automatically locks after 5 minutes if you don’t complete the setup, so work quickly!

Connecting to Docker Environment

After creating your admin account, Portainer will automatically detect your local Docker environment. You’ll see:

  • Environment Name: Usually displays as “local”
  • Environment Type: Shows “Docker Standalone”
  • Connection Status: Should show “Connected” with a green indicator

Click “Connect” to finalize the setup. Portainer will scan your Docker environment and display the main dashboard.

Portainer Dashboard Overview

The Portainer dashboard provides a comprehensive view of your container environment. Understanding the interface helps you navigate efficiently and utilize all available features.

Understanding the Interface

The dashboard is organized into several key sections:

Left Sidebar Navigation:

  • Home: Overview of all environments
  • App Templates: Pre-configured application templates
  • Stacks: Docker Compose stack management
  • Containers: Individual container management
  • Images: Docker image repository
  • Networks: Network configuration and management
  • Volumes: Storage volume management

Main Dashboard Cards:

  • Environment Summary: Shows running containers, images, volumes, and networks
  • Quick Actions: Buttons for common tasks like deploying containers
  • Resource Usage: Real-time metrics when available

Key Features and Functions

Portainer’s strength lies in its comprehensive feature set:

Container Lifecycle Management: Start, stop, restart, and remove containers with single clicks. View real-time logs and access container consoles directly from the browser.

Image Management: Pull images from Docker Hub or private registries, view image layers, and manage local image storage efficiently.

Network Administration: Create custom networks, manage port mappings, and configure network policies without touching the command line.

Volume Management: Handle persistent storage, backup volumes, and manage data lifecycle across container updates.

Managing Containers with Portainer

Container management becomes intuitive with Portainer’s visual interface. Whether you’re deploying new applications or maintaining existing ones, the process is streamlined and user-friendly.

Creating New Containers

To deploy a new container:

  1. Navigate to Containers: Click “Containers” in the left sidebar
  2. Add Container: Click the “Add container” button
  3. Configure Basic Settings:
    • Name: Assign a descriptive name
    • Image: Specify the Docker image (e.g., nginx:latest)
    • Port Mapping: Map container ports to host ports
  4. Advanced Configuration:
    • Environment Variables: Set application-specific variables
    • Volume Mounts: Attach persistent storage
    • Network Settings: Choose appropriate networks
    • Restart Policy: Configure automatic restart behavior
  5. Deploy: Click “Deploy the container” to start your application

Managing Existing Containers

The container list view provides comprehensive management capabilities:

Quick Actions: Each container has action buttons for start, stop, restart, and remove operations.

Detailed Information: Click on any container name to access:

  • Statistics: Real-time CPU, memory, and network usage
  • Logs: Live log streaming and historical log viewing
  • Console: Direct terminal access to the container
  • Inspect: Detailed container configuration and metadata

Bulk Operations: Select multiple containers to perform batch operations like starting, stopping, or removing multiple containers simultaneously.

Security Best Practices

Security should be a top priority when deploying Portainer in production environments. Implementing proper security measures protects both your container infrastructure and sensitive data.

Securing Portainer Installation

Change Default Ports: Consider changing the default ports (8000, 9443) to non-standard ports to reduce exposure to automated attacks:

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

Enable HTTPS: Portainer uses HTTPS by default, but you should replace the self-signed certificate with a proper SSL certificate for production use.

User Access Control: Create separate user accounts with appropriate permissions rather than sharing the admin account. Portainer supports role-based access control (RBAC) for team environments.

Regular Updates: Keep Portainer updated to the latest version to ensure you have the latest security patches and features.

Network Security Considerations

Firewall Configuration: Configure your firewall to allow access only from trusted networks:

sudo firewall-cmd --permanent --add-port=9443/tcp --source=192.168.1.0/24
sudo firewall-cmd --reload

Reverse Proxy: Consider placing Portainer behind a reverse proxy like Nginx or Apache for additional security layers and better SSL certificate management.

Docker Socket Security: The Docker socket mount (/var/run/docker.sock) grants significant privileges. In high-security environments, consider using Docker-in-Docker or rootless Docker configurations.

Troubleshooting Common Issues

Even with careful setup, you might encounter some challenges. Here are solutions to the most common issues when installing Portainer on Rocky Linux.

Connection Problems

Cannot Access Web Interface:

  • Verify that Portainer container is running: docker ps | grep portainer
  • Check if ports are properly exposed: netstat -tlnp | grep :9443
  • Ensure firewall allows connections: sudo firewall-cmd --list-ports
  • Try accessing via IP address instead of hostname

Browser Security Warnings:

  • Accept the self-signed certificate warning for initial setup
  • Add security exception in your browser
  • Consider installing a proper SSL certificate for production use

Permission Issues

Docker Socket Permission Denied:

  • Ensure your user is in the docker group: groups $USER
  • Restart your session after adding user to docker group
  • Verify Docker socket permissions: ls -la /var/run/docker.sock

SELinux Conflicts:

  • Check SELinux status: sestatus
  • If necessary, set SELinux to permissive mode temporarily: sudo setenforce 0
  • Configure proper SELinux policies for production environments

Container Creation Failures:

  • Verify sufficient disk space: df -h
  • Check Docker daemon status: sudo systemctl status docker
  • Review Docker logs: sudo journalctl -u docker.service

Conclusion

Installing Portainer on Rocky Linux transforms your container management experience from command-line complexity to intuitive visual control. You’ve learned how to set up a complete container management environment, from installing Docker to configuring Portainer with proper security measures.

Portainer’s web-based interface makes Docker accessible to users of all skill levels while maintaining the power and flexibility that experienced administrators require. With Rocky Linux providing a stable, enterprise-grade foundation, you have a robust platform for container orchestration that can scale from development environments to production deployments.

Remember to keep your installation updated, follow security best practices, and explore Portainer’s extensive template library to streamline your application deployments. Whether you’re managing a few containers or orchestrating complex multi-container applications, this setup provides the tools and foundation you need for success.

Frequently Asked Questions

1. Can I install Portainer without Docker on Rocky Linux?

No, Portainer requires Docker as it’s designed specifically to manage Docker containers. Docker serves as the container runtime that Portainer connects to and manages. You must install Docker first before installing Portainer.

2. What’s the difference between Portainer CE and Portainer Business Edition?

Portainer CE (Community Edition) is free and includes core container management features suitable for individual developers and small teams. Portainer Business Edition includes advanced features like RBAC, OAuth integration, registry management, and professional support. For most personal and small business use cases, CE is sufficient.

3. How do I backup my Portainer configuration and data?

Your Portainer data is stored in the portainer_data volume. To backup, stop the Portainer container and create a backup of the volume: docker run --rm -v portainer_data:/data -v $(pwd):/backup alpine tar czf /backup/portainer-backup.tar.gz -C /data .. Restore by reversing the process.

4. Can I manage remote Docker hosts with Portainer?

Yes, Portainer can manage multiple Docker environments including remote hosts, Docker Swarm clusters, and even Kubernetes clusters. You can add remote endpoints through the Portainer interface by providing connection details and authentication credentials.

5. Is it safe to expose Portainer to the internet?

While Portainer includes security features like HTTPS and authentication, exposing it directly to the internet increases security risks. It’s recommended to use VPN access, place it behind a reverse proxy with additional authentication, or restrict access to trusted IP addresses using firewall rules.

Marshall Anthony is a professional Linux DevOps writer with a passion for technology and innovation. With over 8 years of experience in the industry, he has become a go-to expert for anyone looking to learn more about Linux.

Related Posts