Install Portainer

/ Comments off

This post goes on the very basics of why and how to install and configure Portainer on a Linux Virtual Machine and then use port forwarding to access the popular GUI. For this tutorial, we would focus on the Community Edition (CE) of Portainer (Installation for BE is the same but you need to plug in license during configuration) and configure. This repo contains helm and YAML for deploying Portainer into a Kubernetes environment. Follow the applicable instructions for your edition / deployment methodology below: Deploying with Helm. Community Edition. Using NodePort on a local/remote cluster. Using a cloud provider’s loadbalancer. Using ClusterIP with an ingress.

How to install Portainer with Docker:

As I mentioned, Portainer is a container; so the installation isn't so much an install as it is a pull. So open up your terminal window (or log into your Docker headless server).

  1. If you haven’t already, install Docker from Synology’s Package Center. While we won’t be using the GUI interface, this installs the necessary components to get Portainer installed. Open File Station and create a new folder named portainer-ce. This is where all of the Portainer files will be stored.
  2. Install Portainer CE. These instructions are for Portainer Community Edition (CE). For Portainer Business Edition (BE), see the BE documentation. The Community Edition of Portainer is free, open source and straightforward to install. There are two options: installing new or adding an environment to an existing installation.

What is Portainer?

Portainer is an amazing open-source project, and you can use that along with Docker:

  • to simplify the process of Deployment
  • to manage different containers
  • to manage different endpoints from the same instance.

But not only that, but it also has not just a beautiful, but also useful UI.

Prerequisites

To follow along, the only prerequisite is to have Docker installed and up and running on your machine.

If you have some containers running before starting to install Portainer, it will be even better, so you can visualize them in the UI as soon as you will run the Portainer instance!

Without Portainer

Usually, when we use Docker, to show all the containers, we type:

and we see something like this:

This works but it doesn’t look very good.

Portainer

Installation

To install Portainer, you can go on the official Portainer site, and click on “Install” at the top right:

Portainer is a tool for Docker…but you can also install it using Docker! Does it sound strange?

To install it we need to type just 2 commands:

Let’s type them together.

On a prompt type:

This will create a local volume on our host, and Portainer will use it to store data.

Docker volumes are the preferred way to persist data when we use containers because when a container is removed everything inside its filesystem is deleted.

We can verify that this volume has been created by typing:

Just another command and we are done!

Let’s see what this command with options does:

  • docker run: creates the container based on the image at the end of the command : portainer/portainer-ce
  • -d : stands for detached: this means that our prompt will not be blocked by the container output
  • -p: is the command to publish a container’s port to the host with the format “external:internal”. in this case , we have port 8000 and 9000
  • –name: to give a custom name to the container. Not mandatory, but useful, otherwise a random name will be assigned.
  • –restart is the restart policy to apply when a container exits. in this case “always”
  • -v /src:/dest is an option to bind mount a directory for a container. in this case, we are connecting to docker.sock. docker.sock is a Unix socket that enables dockerd (the Docker server-side daemon) dockerd, to communicate with its command-line interface via a REST API
  • -v portainer_data:/dest is to use the volume we just created with the previous command.
  • portainer/portainer-ce is the image we are currently using.

And we should see something like this. Since we don’t have the image on our machine, Docker will pull the image from the official Portainer repository, and then it will run the container, from the image which it has just pulled.

Once it’s done, we will see something like this:

Let’s check if the container of Portainer is up and running by typing:

Yes. But to be honest, it doesn’t look that pretty.

Now let’s go to our favorite browser and visit “localhost:9000”

And we should have something like this:

Install Portainer

we can choose:

  • Username
  • Password and confirm

and then click “Create User”

On this second screen, select Docker, first option on the left, and click “Connect”

And here we can see the Portainer UI, click on “local” which is our current machine

On this Dashboard, click on Containers (in this case 3, one is Portainer itself)

Install

Install Portainer Windows

and here we can see the containers on our machine:

Here you can do many things. Let’s see just one.

Click on the terminal icon (it looks like >_) :

And then on the “Connect” button

Install Portainer Windows

We are inside the container!

We can type commands like “ls” to show the content of the container’s filesystem :

Now, this is not something new, you can have the same result by typing:

Install Portainer Agent

For example in this case, since my container starts with 0aa, I can have a similar result

But using Portainer, I don’t have to check the container id and the correct syntax for the docker exec command.

in the Portainer UI, you can check all the docker objects:

Install Portainer Ssl

  • containers
  • images
  • networks
  • volumes

Install Portainer Via Docker

Thank you for reading.

Install Portainer Ubuntu

from Tumblr https://generouspiratequeen.tumblr.com/post/662372424650768384