How to Install Portainer CE with Docker on Linux

Introduction

(How to Install Portainer CE with Docker on Linux) Portainer Community Edition (CE) is an open-source container management tool that provides a simple web-based interface for managing Docker environments. Whether you are running Docker on a standalone Linux server, in a swarm, or on Kubernetes, Portainer makes container management straightforward.

This guide provides step-by-step instructions on how to install Portainer CE using Docker on a Linux machine. We will cover prerequisites, installation steps, configuration, and some basic usage of Portainer.

Prerequisites

Before proceeding, ensure that you have:

  • A Linux machine with a 64-bit architecture
  • Root or sudo privileges
  • Docker installed on your system
  • An active internet connection

Checking for Docker Installation

To check if Docker is installed, run:

How to Install Portainer CE with Docker on Linux

If Docker is not installed, follow the steps below to install it.

Step 1: Install Docker on Linux

If Docker is not already installed, you can install it using the following steps:

Update System Packages

How to Install Portainer CE with Docker on Linux

Install Docker

For Debian-based systems:

How to Install Portainer CE with Docker on Linux

For RHEL/CentOS-based systems:

How to Install Portainer CE with Docker on Linux

Start and Enable Docker

How to Install Portainer CE with Docker on Linux

Verify Docker Installation

How to Install Portainer CE with Docker on Linux

You should see an output similar to Docker version 20.xx.xx, build xxxxxxx.

Step 2: Install Portainer CE

Download and Install Portainer

Portainer runs as a container inside Docker. Run the following command to pull and run Portainer:

How to Install Portainer CE with Docker on Linux

Explanation of Parameters:

  • -d : Runs the container in detached mode
  • --restart=always : Ensures the container restarts automatically
  • -p 8000:8000 and -p 9443:9443 : Maps necessary ports for Portainer
  • -v /var/run/docker.sock:/var/run/docker.sock : Grants Portainer access to the Docker socket
  • -v portainer_data:/data : Creates a persistent volume for Portainer data

Verify Portainer Installation

Check if the Portainer container is running:

How to Install Portainer CE with Docker on Linux

You should see an output showing that the Portainer container is running.

Step 3: Accessing the Portainer Web UI

Once the Portainer container is running, access it using a web browser:

URL: https://<your-server-ip>:9443

The first time you log in, you need to set up an admin password and choose a Docker environment to manage.

Step 4: Configuring Portainer

Setting Up an Admin User

  • Open https://<your-server-ip>:9443 in your browser.
  • Enter a secure password for the admin user.
  • Click Create User.

Connecting to the Docker Environment

  • Select Docker Standalone.
  • Click Connect.

Portainer will now detect all running containers on your system.

Step 5: Using Portainer

Creating a New Container

  • Navigate to Containers.
  • Click Add Container.Click Add Container.
  • Fill in details such as Container Name, Image, and Network.
  • Click Deploy the Container.

Managing Existing Containers

  • Start/Stop/Recreate Containers
  • View Logs
  • Monitor Resource Usage

Using Stacks

You can also deploy applications using Stacks, which allows you to manage multiple containers with Docker Compose files.

Step 6: Updating Portainer

To update Portainer to the latest version, follow these steps:To update Portainer to the latest version, follow these steps:

How to Install Portainer CE with Docker on Linux

Step 7: Uninstalling Portainer

If you no longer need Portainer, you can remove it using:

How to Install Portainer CE with Docker on Linux

If you want to remove Docker completely:

How to Install Portainer CE with Docker on Linux

Step 8: Backup and Restore Portainer Data

To create a backup of Portainer data:

How to Install Portainer CE with Docker on Linux

To restore Portainer from backup:

How to Install Portainer CE with Docker on Linux

Step 9: Running Portainer with Docker Compose

Create a docker-compose.yml file:

How to Install Portainer CE with Docker on Linux

Start Portainer using Docker Compose:

How to Install Portainer CE with Docker on Linux

Step 10: Running Portainer on a Custom Port

If you need to run Portainer on a different port, modify the docker run command:

How to Install Portainer CE with Docker on Linux

Now, access Portainer using https://<your-server-ip>:9000.

Conclusion

The installation of Portainer CE with Docker on Linux has been achieved successfully through this guide. Users can manage their containers through Portainer by means of its intuitive web-based interface which helps them deploy and manage containers and images and networks.

Users can effectively deal with Docker environments through Portainer thanks to its powerful features in combination with its intuitive web interface which suits newbies as well as experienced users. The system streamlines container orchestration tasks and monitoring operations therefore you can dedicate your efforts to seamless application building and deployment.

Leave a Reply

Your email address will not be published. Required fields are marked *