How to set up agent edge on multiserver

Docker-compose is my go-to for secondary or distributed servers. It’s better than docker run because it’s more clean and organized and easier to set up. And one time, too.

So all you need to do is make sure the Secondary Server or Multiserver needs to install Docker and Docker Compose. Please follow this step by step.

Install Docker Engine on Ubuntu | Docker Documentation

Now that we have created the docker-compose files, we can create them where you want them to be saved. The secondary server has not yet set up Portainer, so this tutorial is for using SSH instead of Portainer. The docker compose will do the job, and our primary server will attach secondary from an outside server. This is cool, no need to use a port or anything else.

Open the Portainer site on the primary server, then go to environment, add environment, Docker standalone, start wizard, and edge agent standard. Write down your edge ID and key in this way.

You should see Edge ID and Edge Key on the primary Portainer site.

Please ensure that you obtain the Edge ID and Edge Key. Make sure to change your volume path and change your volume path. Look for the highlights below.

Version: '3.9'
services:
    agent:
        image: 'portainer/agent:2.20.2'
        container_name: portainer_edge_agent
        environment:
            - EDGE_INSECURE_POLL=1
            - EDGE_KEY=
            - EDGE_ID=
            - EDGE=1
        restart: always
        volumes:
            - '/yourpathportainer/data:/data'
            - '/:/host'
            - '/var/lib/docker/volumes:/var/lib/docker/volumes'
            - '/var/run/docker.sock:/var/run/docker.sock'

After deploying the stack, your secondary portainer should be active and should appear on your primary portainer. Look like this:

Continue to deploy and build Docker Portainer many more servers to benefit the future!


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.