Install Portainer on Rocky Linux 8: Best Docker GUI Tool

Posted on

Install Portainer on Rocky Linux 8: Best Docker GUI Tool

In this guide, you will learn to Install Portainer on Rocky Linux 8. Portainer is a GUI tool to easily manage containers in Docker, Docker Swarm, Azure ACI, and Kubernetes, be it on-prem or in the cloud. It simplifies container management, making it accessible even for those less familiar with the command line.

Portainer is itself deployed as a Docker image and is very lightweight. It’s made up of two core elements: the Portainer server and the Portainer agent. The agent communicates with the server to provide access to the node’s resources.

You can install Portainer on Linux or Windows, and it even supports installation on Windows Subsystem for Linux (WSL). Under the hood, Portainer utilizes the Docker CLI to offer you a good level of abstraction. This allows you to perform complex tasks with ease, benefiting from the power of Docker without needing to memorize intricate commands.

Now follow the guide steps below on the Orcacore website to set up Portainer on Rocky Linux 8.

1. Requirements for Portainer Setup

Before you Install Portainer on Rocky Linux 8, you need some prerequisites. Let’s see what are.

You must log in to your server as a root or non-root user with sudo privileges. To do this, you can follow this guide on Initial Server Setup with Rocky Linux 8.

Then, you must have Docker installed on your server. To do this, you can follow our guide on Install and Use Docker on Rocky Linux 8.

Also, you must have Docker Compose installed on your server. For this purpose, you can visit this guide on Install Docker Compose on Rocky Linux 8.

When you are done, follow the steps below.

2. Set up Portainer on Rocky Linux 8

At this point, you can start to install Portainer container management on your server.

Create Docker Volume For Portainer

First, you need to create a volume to store Portainer data. Docker volumes are file systems mounted on Docker containers to preserve data generated by the running container. To do this, run the command below:

docker volume create data

Then, verify it by using the command below:

docker volume ls
**Output**
DRIVER    VOLUME NAME
local     data

Download and Run Portainer Docker Image

Now you can use the following command to download and run the Portainer docker image:

docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v data:/data portainer/portainer
**Output**
latest: Pulling from portainer/portainer
772227786281: Pull complete
96fd13befc87: Pull complete
0bad1d247b5b: Pull complete
b5d1b01b1d39: Pull complete
Digest: sha256:47b064434edf437badf7337e516e07f64477485c8ecc663ddabbe824b20c672d
Status: Downloaded newer image for portainer/portainer:latest
aa302024c0d4368876b431288a596815f27c51bcfff1de3a41e13c1d29d6ebc3

Check Portainer Status

Next, check your Portainer status with the following command:

docker ps
**Output**
CONTAINER ID   IMAGE                 COMMAND        CREATED          STATUS          PORTS                                                                                            NAMES
aa302024c0d4   portainer/portainer   "/portainer"   25 seconds ago   Up 23 seconds   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp, 9443/tcp   portainer

3. Access Portainer Dashboard on Rocky Linux 8

At this point, your Portainer is running on port 9000. You can access it through the web interface by typing your server’s IP address in your web browser followed by 9000:

http://your-server-ip:9000

In the first screen, you should create the initial administrator user.

Portainer administrator user - Install Portainer on Rocky Linux 8

Then, you will see your Portainer dashboard.

Access Portainer Dashboard

The Dashboard page gives you a glance at your operational environment with important statistics. You can click on each of the components in the dashboard to get more info regarding a specific component.

You can easily get a summary of how much disk space your containers are consuming and which ones are healthy or not. Also, you can get a good overview of network interfaces and IP addresses of your Docker containers.

Apart from the Docker information, you can also get PC RAM capacity. You won’t find any Docker command that gives you such a comprehensive summary within a single page. And this is where Portainer shines. The process to Install Portainer on Rocky Linux 8 is now complete!

Conclusion

At this point, you have learned to Install Portainer on Rocky Linux 8. Portainer helps you to manage Docker containers from a graphical interface.

Hope you enjoy it. Please subscribe to us on Facebook, YouTube, and Twitter.

Also, you may like to read the following articles:

Run Docker Containers with Portainer

Manage Docker Containers with Portainer on Umbrel OS

Install Portainer on Centos 7

Alternative Solutions to Installing Portainer on Rocky Linux 8

While the above method using Docker directly is perfectly valid, there are a couple of alternative approaches you could take to deploy Portainer on Rocky Linux 8. These alternatives offer slightly different benefits in terms of automation, configuration management, and orchestration.

1. Using Docker Compose (Alternative)

As mentioned in the requirements, Docker Compose is already installed. While the provided guide uses a single docker run command, using a docker-compose.yml file offers better reproducibility and easier management of the Portainer container.

Here’s how you can use Docker Compose:

  1. Create a docker-compose.yml file:

    version: "3.9"
    services:
      portainer:
        image: portainer/portainer-ce:latest
        container_name: portainer
        ports:
          - "8000:8000"
          - "9000:9000"
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
          - portainer_data:/data
        restart: always
    
    volumes:
      portainer_data: {}
  2. Deploy the stack:

    Navigate to the directory where you saved the docker-compose.yml file and run:

    docker-compose up -d

    This command will create the Portainer container in detached mode. Docker Compose also automatically creates the volume portainer_data which is equivalent to the docker volume create data command used in the original article.

Explanation:

  • The docker-compose.yml file defines the service (Portainer) and its configuration.
  • version: "3.9" specifies the Docker Compose file version.
  • image: portainer/portainer-ce:latest defines the image to use for the container. portainer/portainer-ce is the community edition and is a recommended alternative to the deprecated portainer/portainer image.
  • container_name: portainer sets a name for the container.
  • ports maps the host ports to the container ports.
  • volumes mounts the Docker socket and the portainer_data volume. Using named volumes like this is preferable to bind mounts as it is easier to manage.
  • restart: always ensures that Portainer restarts automatically if it crashes.
  • The volumes section at the end defines the named volume used for Portainer data.

Benefits of using Docker Compose:

  • Configuration as Code: Your Portainer configuration is stored in a file, making it easy to version control and share.
  • Simplified Management: You can start, stop, and restart the entire Portainer stack with a single command (docker-compose up -d, docker-compose down).
  • Reproducibility: Deploying Portainer on different environments becomes consistent as the configuration is defined in the docker-compose.yml file.

2. Using Podman (Alternative)

Podman is a container engine that is a drop-in replacement for Docker in many cases. It can be installed and used without requiring a daemon, making it a popular choice for security-conscious environments. Here’s how you could install Portainer using Podman.

  1. Install Podman and Buildah:
sudo dnf install -y podman buildah
  1. Create a Podman Volume:
podman volume create portainer_data
  1. Run the Portainer Container:
podman run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data docker.io/portainer/portainer-ce:latest

Explanation:

  • sudo dnf install -y podman buildah installs Podman and Buildah, which is required for building container images if needed.
  • podman volume create portainer_data creates a volume named portainer_data to persist Portainer’s data. This is similar to the docker volume create command.
  • podman run ... is similar to the docker run command, but uses the podman command instead. Note that we are now using docker.io/portainer/portainer-ce:latest as the image name. This specifies the source registry for the image and also switches to the community edition.

Benefits of using Podman:

  • Daemonless Architecture: Podman doesn’t require a central daemon to run containers, which can improve security and reduce resource consumption.
  • Rootless Containers: Podman supports running containers as a non-root user, further enhancing security.
  • Docker Compatibility: Podman is largely compatible with Docker commands and images, making migration easier.

These alternative solutions provide flexibility in how you choose to Install Portainer on Rocky Linux 8, allowing you to select the method that best suits your environment and requirements.