how to set up agent edge on multi server

I like to use docker-compose for my secondary or multi Server. It is better than docker run because docker-compose is more clean and organize and order and easier to set up. And one time.

So all need to make sure Secondary Server or multiserver need to install docker and docker-compose. Please follow this step by step.

Install Docker Engine on Ubuntu | Docker Documentation

Then now we can create this docker-compose files to where you want to save. Again, this need to use ssh not Portainer because the secondary server hasn’t set up Portainer yet, so this is what the tutorial for. So, This docker-compose will do the job and our primary server will attach secondary from outside server which is cool, no need to use port or anything.

Now go over to Primary Server open Portainer site then go to environment then add environment then docker standalone then start wizard then edge agent standard. Then write down your edge ID and Key like this:

You should see Edge ID and Edge Key on the primary Portainer site.
Don’t worry, this deleted and these numbers won’t work on any server.

Make sure you get Edge ID and Edge Key.

version: '3.3'
            - '/var/run/docker.sock:/var/run/docker.sock'
            - '/var/lib/docker/volumes:/var/lib/docker/volumes'
            - '/:/host'
            - './portainer_agent_data:/data'
        restart: always
            - EDGE=1
            - EDGE_ID=YouredgeID
            - EDGE_KEY=YourKey
            - EDGE_INSECURE_POLL=1
        container_name: portainer_edge_agent
        image: 'portainer/agent:2.18.4'

Deploy the stack, then your Portainer on secondary is all action and should show up on your primary Portainer. Look like this:

Keep deploying and keep building docker Portainer many servers to benefits for future!


Leave a Reply

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