Maitri Pasale
Maitri Pasale's Blog

Maitri Pasale's Blog

A Beginner's Guide to Portainer

A Beginner's Guide to Portainer

Container management simplified

Maitri Pasale's photo
Maitri Pasale
·May 16, 2022·

6 min read

Play this article

Table of contents

Have you ever imagined if there could be a tool that would manage multiple containers, which is difficult to maintain through CLI, with a stylish UI, simple operability, and spot problems easily?

About Portainer

Portainer is an open-source, self-hostable, Universal Container Management System and UI solution for Docker, Kubernetes and Azure ACI. With it, you can also connect to multiple clusters, access the shell of containers, migrate stacks between clusters and more, all based on a good intuitive facility.

It simplifies container management for you so that you can deliver software faster to more places with less risk.

A container is a package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings. Thus it runs on any environment, be it a public cloud, private data center or personal laptop.

Getting Started with Portainer

Portainer comes in two different editions: Business edition(BE) and Community Edition(CE).

The Community Edition is open source, free and suitable for individuals and small, self-supporting teams and the Business Edition is designed for larger organizations and business-wide use in a production environment. Check it here.

Screenshot 2022-05-16 174220.png

Portainer Architecture

Portainer can be deployed inside any Kubernetes, Docker, or Docker Swarm environment and, once deployed, can be used to simplify the deployment of containerized apps, triage performance problems, and manage platform governance.

It consists of the Portainer Server and the Portainer Agent. Both the Server andthe Agent run in containers inside your environment. An instance of the Agent must be deployed on every node in the clusters you want to manage and be configured to talk back to the central Server for Portainer to operate. A different, lightweight version of the Portainer Agent is required for edge / IIOT deployments to communicate back to the server.

A single Portainer Server will accept connections from any number of Portainer Agents, providing the ability to manage multiple clusters from one centralized interface. To do this, the Portainer Server container requires data persistence. The Portainer Agents are stateless, with data being shipped back to the Portainer Server container.

Portainer is accessed through any web browser over HTTPS. Role permission is all controlled via the fully integrated RBAC engine to ensure no one gets access to functionality they shouldn’t have. Portainer CE supports basic RBAC with 2 roles and Portainer Busines Edition supports a far richer set of roles.

The Kubernetes compatible API, which is part of both Portainer CE and Portainer BE, allows Portainer to be used as the security conduit between third-party developer tools and clusters. It enables developers to use any tool they like whilst having their access permissions managed by Portainer.

Screenshot 2022-05-16 181616.png

Features of Portainer

Screenshot 2022-05-16 181831.png

1. Application Deployment

Portainer has its own GUI, which users find easy to get started. Also, it incorporates an API that allows it to connect to CI/CD tools or third-party dashboards/deployment tools.

Manual deployment options

Screenshot 2022-05-16 183232.png

Automated deployment options

Yes! Automation feature is also provided by Portainer as it acts as a Continuous Deployment System and allows users to connect Portainer to their Git repos so that it automatically deploys any application repo, and thus reverts back any changes to the running application.

2. Observability

Developers need to know how their apps are behaving inside their containers. This capability is captured under the category of observability.

code-working-tests-broken-meme-350x250-882005543.jpg

3. Governance and Security

Security is an important feature in any orchestration platform that's why Portainer helps to secure the environments and provides the ability to backup and restore the Portainer configuration database.

4. Platform Management

Portainer provides functionality that allows engineers to both configure the orchestrator and then set up configuration rules which define what developers can and can't do inside the environment.

Installation of Portainer

I have installed Portainer for docker standalone on the docker desktop. You can set up a new Installation from this guide.

If you want to add a new environment to an existing installation then you can follow these steps.

If you want to upgrade your Portainer, check out here.

Running Portainer

After installation, open a terminal and run the below command to create the volume that Portainer Server will use to store its database:

docker volume create portainer_data

Now run the following command to start the Portainer container.

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 understand the above command:

  • docker run -d is used to launch a container in background mode

  • -p 8000:8000 exposes the port for tunnelling, so the edge agents can talk to the server.

  • -p 9443:9443 shows up the port for UI and API.

  • --name portainer names the container 'portainer'

  • --restart=always starts the container automatically, when the docker daemon restarts.

  • v /var/run/docker.sock:/var/run/docker.sock accumulate in the docker sock so that we can manage local containers.

  • -v portainer_data:/data mounts the volume we created

  • portainer/portainer-ce:latest runs containers of latest version

After running the above commands, you should see something like this:

docker.png

Connecting to Portainer

After running Portainer, open your browser and type in:

 https://localhost:9443

You might see a browser error message stating that the URL is not safe, can be ignored.

You will be prompted to enter your username and password to create a new account.

admin.png

After logging in, click on Get Started and the screen will look similar to the following.

home.png

Click on local to be redirected to the following screen:-

local.png

You can view your dashboard, running containers, stacks, volumes, networks, images, and more from the sidebar.

From the menu section, you will find many listed things such as:

  • App templates - Click any of the templates you want to configure.

template.png

  • Containers - To see all available containers.

containers.png

  • Images - You can also pull images from the docker hub additional to this.

images.png

  • Host - All the details about the host are listed here.

host.png

If you want to deep dive into Portainer concepts, visit their Official Portainer Documentation and if you have any queries scroll down to the FAQ section, where they have covered everything related to Installation, Upgrading, Troubleshooting, Contributing FAQs'.

Conclusion

As you can see, working with Portainer makes your job go smooth as you can do everything, starting with creating, and managing your local containers till deploying them with a simple GUI without hassling with the CLI, and in that way, you get a lot of your important work done.

Resources

 
Share this