Portainer Beginners Guide
If you have been running Docker in your homelab for some time, you may have headaches trying to use the CLI in some environments, especially running many containers. You may think it would be nice to have a GUI for the environment to handle some administration tasks with Docker in a single place. This article will discuss how you can use Portainer to make your administration tasks a little easier. We will cover what Portainer is and how you can use it, how you install Portainer on a host and some simple administrative tasks you can carry out using Portainer.
What is Portainer
Portainer is an open-source project that came about from realizing that the Docker technology was going to be game-changing for organizations but it was tough to operate. For containers to become mainstream, developers and administrators had to solve these operational challenges quickly.
The Portainer project aims to provide a single application for the management of multiple different container runtime platforms, including Docker (both local and remote), Docker Swarm, Kubernetes and Nomad. Portainer reduces the operational complexity associated with multi-cluster management by bringing users easy-to-use tools to administrate common container operations and resources. These provided utilities bridge the skills gap and facilitate feature discovery for new users of Portainer and containers as a technology. Through Portainer, you are also equipped with a centralized access management application for all your container runtimes, allowing you to easily manage access, permissions, groups and log audit activity on your container runtimes.
Portainer runs with both business and community editions that you can run on your infrastructure or have hosted by Portainer as a SAS product. A breakdown of the features of the two projects can be seen below.
Generally, the community edition of Portainer is recommended for testing the application or for use with a single user and node setup. However, the core Portainer features like running, viewing and managing containers are not locked behind the business edition or a license being purchased.
Installing Portainer
Getting up and running with Portainer is nice and easy as the application runs in a container. The following docker commands will get a Portainer instance up and running on your machine so you can test its functionality.
$ docker volume create portainer_data $ 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 |
Once the container has started, you can access the GUI at https://localhost:9443 since it will be using a self-signed certificate to accept the warming from your browser, and you will be prompted to do the initial setup for the Portainer instance.
Configure the admin user for your needs, this will be the root user of the server and can be used to configure all other users and features on the server. Once you have created the root user, you will have access to the Portainer dashboard, where you can configure an environment for Portainer to interact with. The “Get Started” card will get you up and running, monitoring the same instance of Docker that Portainer is running on.
Portainer can integrate with environments other than Docker, such as Docker swarm, Kubernetes and more. For information on setting these up, refer to the following documentation link.
If you want to run the Portainer server on other platforms such as WSL, Docker Swarm and Kubernetes, you can find more information for running the Portainer server at the following links.
- https://docs.portainer.io/v/ce-2.9/start/install/server/docker/wsl
- https://docs.portainer.io/v/ce-2.9/start/install/server/swarm
- https://docs.portainer.io/v/ce-2.9/start/install/server/kubernetes
Administering Docker With Portainer
With Portainer, you are provided with a single dashboard to administer your docker runtime. This section will cover some of the key features you may be interested in.
User and Groups
Portainer has its own RBAC model to allow you to quickly create users and provide them access to resources. Creating new users on your Portainer server is easy, and after their creation, they can log in to the dashboard and access resources just like the admin user.
To these users, you can assign them roles to restrict the user's access to resources based on these predefined roles. For all of these roles, take note of the need for a business license to use these features. But if you are running in a multi-user environment, this feature will be essential for providing the least privileged access to your docker resources.
Grouping Environments
With Portainer, you can configure it to access and manage many environments that could be used by many developers or teams with their access requirements. This is where the ability to group resources comes into play. Creating environment groups allows you to group your resources into logical groups for your needs.
With these groups created, you can then apply access control to specific developers or roles to allow easier administration of resources available in Portainer. Further details on managing this access can be found at the following link.
Registries
If you have container images in public or private registries, you can configure them to be accessible via your runtime engine through the Portainer dashboard.
Container Runtime Interactivity
With all of the runtime configuration done in Portainer, your developers are ready to start running containers on the configured environments through the Portainer dashboard. Portainer allows for all the same actions you can do through the docker CLI through the GUI, including running containers, starting docker-compose stacks, pulling images and inspecting the resources and logs of currently running containers on the environment.
Through Portainer, you are provided with a single point of access to many configured container environments quickly without having to manage secure connectivity for each of your developers or users. Even if you are running Portainer in your homelab or just for yourself, Portainer can provide you with a one-stop shop for all things container operations and administration without needing to jump between hosts.
Wrapping Up
You should now have a better idea of how you can get started with using Portainer to manage the administration and operating of your container runtimes easier. Through its GUI, your days of jumping between hosts via SSH to run some Docker commands are over with a generous community edition and the room to grow with extra features if needed.
Connect Further
- If you are in the market for some homelab or home server products check our store's products.
- You can also find some of our other blog posts.
- Connect on our social media accounts over on Twitter, Facebook and Instagram.
Diane
Thanks for the informative blog post!