Containers Linux

How to Install Docker Portainer on Linux

portainer_feature

Portainer is a compact container management application that offers a GUI for streamlining container operations. Moreover, it supports numerous Docker environments, Kubernetes, Nomad and all of the major orchestration platforms (Docker hosts and Swarm clusters). The Portainer Server and the Portainer Agent are the two components of Portainer. This tutorial will take you through the steps of installing docker portainer on a Linux machine especially Ubuntu and also show you how to add multiple environments to portainer. Please check through these links for Other useful articles: Diagnostic Data in Windows 10 and Windows 11 and How to upgrade from Ubuntu 20.04 LTS to 22.04 LTS and Authentication: How to use a Fido Certified U2F Key and How to Add a Device to your Microsoft account and How to Add a Device to your Microsoft account.

The benefit of using Docker Portainer

Installing Docker Portainer eliminates the difficulty of maintaining and deploying containers

A genuinely platform-independent container-native application deployment and management solution is what Portainer aims to achieve. To do this, we’ve made the underlying container management technology (such as Kubernetes) opaque to the developers who just want to manage their apps. However, without being an expert, you can CONSUME the container platform if you utilize Portainer.

The management of containers is made more efficient by Portainer

Without using the command line, engineers can deploy individual containers, monitor their status, restart them as needed, and perform debugging with Portainer. To help engineers improve app performance, Portainer also offers deep visibility into what is running, where it is running, and how it is running. Additionally, because Portainer connects to all your hosts and platforms, you can view all your containers’ information on a single webpage, negating the need to connect to each one individually to check on their status. This allows engineers to concentrate on what’s crucial while saving a ton of time.

Follow best practices for IT governance

Technology executives need to possess skills for managing software in a repeatable, scalable, and secure manner. Installing Docker Portainer supports organized framework, which also makes it possible for teams to cooperate. By doing this, you lower the risk to your company and make it easier for you to install and operate your apps in a compliant manner. Additionally, Native container platform management has difficulty with identity and access management, which Portainer fixes. It enables you to grant particular roles with pre-determined capability restrictions to individuals and teams. What’s more, you can even layer roles to create fine-grained access privileges.

Requirements to Install Docker Portainer

Kindly ensure the following prerequisite are met before you install Docker Portainer

  1. Docker installed on your Linux machine
  2. Sudo Privileges
  3. Ubuntu 20.04 and higher

Step1: Confirm you have docker installed

Once you met all the requirements, you can proceed to install the docker portainer on Linux.

docker --version
how to install docker portainer-dv
docker –version

Step 2: Create Docker Volume

Information is kept in Portainer on a Docker volume. To create a Docker volume for the Portainer Server, enter the command shown below:

docker volume create portainer_data
how to install docker portainer-data
portainer_data

The system outputs the volume name if the procedure is successful as seen from the screenshot above,

Step 3: Install Portainer Server

Docker Hub has the most recent Portainer Community Edition image. Pull the image and launch a Portainer Server container using the docker run command:

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:2.9.3

Portainer uses secure port 9443 to offer the user interface. Unless you want to employ edge agents, port 8000, mostly used for edge computing, is unnecessary.

how to install docker portaine- docker-run-protainer
docker run portainer

The container is started, and the required images are retrieved via docker run. Type the following to see if Portainer is active:

docker ps

The command below lists all the active containers. Verify that the portainer container is there and that its state is Up.

how to install docker-ps-1
docker ps

Step 4: Access Portainer Dashboard

You can use an internet browser to access the web UI for Portainer. Here’s how to go to the primary Portainer dashboard after you’ve installed Docker Portainer.

1: Visit the following URL in a browser:

https://localhost:9443

2. The first time you access Portainer, the system asks to create a password for the admin user. Thus, type the password twice and select the Create user button.

how to install docker Portainer_UI
portainer_ui

The Environment Wizard runs immediately when you hit the create user button as shown above and it reveals the interface shown below

3. Choose the Get Started option to see the dashboard and begin using Portainer exclusively locally. During the initial setup, select Add Environments to add more environments.

how to install docker portainer-get-started-and-environment
get started + add environment

Get started gives you the environment shown below

how to install docker portainer-local-environment
local environment

Step 4 (Optional): Increase the number of environments when you install the docker portainer

The Portainer UI allows you to manage several Docker setups. Additionally, a Portainer Agent instance has to be installed in each environment. The agent then communicates with the server on port 9001.

To add an environment to Portainer, follow these instructions:

1: On the machine you wish to add, use the following command below to launch a Portainer Agent container:

docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent:2.9.3

be patient for Docker to pull to the necessary images and initiate the container.

how to install docker portainer-new_environment-1
new environment

2. The IP address of the machine hosting the environment is required to register the new environment in Portainer. To find the IP if you don’t already know it, use the ip command:

ip a

The command lists the network interfaces on your system. Make a note of the main interface’s IP address.

ip-address
ip address

Return to the Portainer Server UI.

3. From the menu on the left, choose Environments, then click Add environment.

add-environments
add environments

If you select the Add Environments button in Step 3, Portainer takes you directly to the Create Environment page.

4.Enter the information about the environment you wish to add on the Create Environment page.

5. Type the URL of the system running Portainer Agent in the Environment URL field. (I used the IP from step2) : port number as shown below

[ip-address]:9001

6.  When you finish the setup, select the Add environment button in the Actions section.

new-env_url
portainer environment url

On the Environments page, the brand-new environment is shown.

techdirect_new
added environment appears

Step 5: Deploy Container Using Portainer

Deploying a test Docker container will allow you to test your Portainer configuration. Installing an instance of Apache HTTP Server requires the procedures listed below.

1: The Containers page will open when you choose Containers from the menu on the left.

containers
containers

2.In the action bar, click the Add container button.

add_container
add container

3. Specify the container you wish to use, including its name, the name of the image, and the connection ports.

httpd
add httpd container

4. After configuring the container, click the Deploy the container button at the bottom of the page.

deploy-container
deploy

It might take a while for it to start running but wait for it.

new-httpd-runing
new-container running

5. Open a new tab in your browser and enter your environment’s IP address, followed by the port designated for the container. The Apache server displays the confirmation message.

It-works-portainer
It works

Summary

In conclusion, you’ve learned how to install Portainer to manage Docker containers on Linux, following the instructions in this article. Furthermore, the steps for establishing a Portainer Server instance and adding environments to your installation were covered in the tutorial.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x