Sunday, July 14, 2024
FeaturedSysAdmin

Remote Docker Hosts Management With Portainer Agent

Hi sobat Kekasi, now we will learn how to manage docker on other server (remote docker) using portainer agent. We will install this portainer agent on remote docker (example 192.168.1.5) and we will connect to portainer server (example 192.168.1.9). By doing this configuration, we can manage docker that is on local or on other server in one dashboard view, so it’s easier for us to managing and monitoring docker we use.

Portainer using portainer agent to communication with portainer server and provide access to node resource. I will explain How To Install Portainer Agent on node and how to connect it to the portainer server. If sobat Kekasi don’t have a working portainer server yet, please see the guideline about How To Install Portainer Server first.

How To Install Portainer Agent

On remote docker (example 192.168.1.5) run the following 2 commandments:

$ 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.2
$ 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 cr.portainer.io/portainer/agent:2.9.3

Connect Portainer Agent to Portainer Server

Access Portainer Server (example 192.168.1.9) by accessing the page:

https://192.168.1.9:9443
  1. Enter the username and password of Portainer Server
  2. Choose Environments menu. Click Add environment on the right side
  3. After that, on the Environment type choose Agent (Portainer Agent)
  4. On the Environment Detail – Name form, and fill in the name as sobat Kekasi wish
  5. On the Environment Detali – Environment URL form, fill in 192.168.1.5:9001 (192.168.1.5 is IP server where we install portainer agent)

So that is How To Install Portainer Agent and Connect to Portainer Server to make it easier for us to manage Docker and monitoring Docker. Please watch the tutorial video for more information

Tutorial Video

Watch on Youtube