Reading Time: 2 minutes
Hello, today we are going to see how we can install Portainer for our Docker projects.
Portainer is a container management platform that provides a graphical user interface (GUI) for managing and monitoring container environments. It allows users to easily manage container clusters, create, start and stop containers, manage container images, monitor container performance and status, among other functionalities.
Portainer is compatible with different container engines like Docker and Kubernetes, making it flexible and versatile. It provides an intuitive and user-friendly interface, making container management easier for users of all experience levels.
With Portainer, users can efficiently manage and orchestrate containers, enabling them to quickly and easily deploy applications. It also offers advanced features such as volume management, network configuration, and task scheduling, allowing for greater flexibility in deploying and managing applications in container environments.
In summary, Portainer is a tool that simplifies the management and monitoring of containers, providing an easy-to-use visual interface for container environment management.
To set up Portainer in our environment, we need to create a docker-compose.yml file with the following content:
version: "3.1" services: portainer: image: portainer/portainer-ce:latest container_name: portainer_container restart: unless-stopped security_opt: - no-new-privileges:true volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock:ro - ./config/portainer:/data ports: - 9000:9000
In the volumes section, localtime is referenced to obtain the local system date.
The docker.sock file is referenced to communicate with Docker installed on the machine.
And we create a folder in the root directory /config/portainer where container data is stored.
Now, to launch the container, we use:
docker compose up -d
Once launched, we can access it from:
http://localhost:9000
The first time, it will prompt us to set up an admin user and password for access.
Once we have accessed, the following panel will appear:
Indicating the system’s characteristics, CPU, RAM, and running containers.
If we access the containers, we can manage them, from stopping, restarting, deleting, or recreating them.
We can also view the logs or access the console directly:
As you can see, it is quite useful for managing our Docker or Docker Compose environment.
It is also important to secure this instance with a Proxy or only access via VPN.