Deploying to multiple servers using app templates

Hi - I am looking the way to use app template to deploy docker container on 80+ servers. Also need to use variables as my container name will be different on each of servers. I want to append hostname to container name.

Depends on your setup.

  • If all servers are in a swarm you could easily achieve this by using a stack app template which specifies a global deployment.
  • Otherwise, you would need to add each server as an endpoint in Portainer, select the endpoint, go to app templates, deploy the template and repeat for each server.

In regards to env variables, you may be able to achieve this by using a compose stack like so where the name of my server is in the env var HOST. Note: container name is not supported in swarm

version: '2'
services:
  web:
    image: nginx
    container_name: 'nginx_${HOST}'