If you’re using Portainer as your Docker container manager, there’s yet another cool feature to be found that makes it very easy to deploy full-stack applications from templates. In seconds, you could deploy a full-stack application, such as WordPress, and even create new stacks based on templates.
SEE: Hiring kit: Back-end Developer (TechRepublic Premium)
At the moment, there are only nine templates available (Redis Cluster, Portainer Agent, OpenFaaS, IronFunctions, CockroachDB, WordPress, Microsoft OMS Agent, Sematext Docker Agent and Datadog agent), but I presume there will be more coming. Of course, you can always create your own full-stack application template (more on this in a bit), but even with this limitation, the feature is a great way to not only deploy a full-stack application but to learn how full-stack applications are pieced together in Portainer.
I want to walk you through the process of deploying a full-stack application from a Portainer Template.
What you’ll need
The only thing you’ll need to make this work is a running instance of Portainer. With that platform ready to go, it’s time to deploy.
How to access App Templates
Log into Portainer and you should see the App Templates section in the left navigation (Figure A).
Click on App Templates and, once the templates are downloaded, they’ll appear as a list (Figure B).
At this point, you have two options. The first is to simply click WordPress, fill out some basic information (such as a name), add a database password (Figure C), assign access control, and click Deploy the stack.
That’s the basic method. If you really want to learn how a full-stack application is pieced together, your best bet is to go back to the App Templates window and click Copy as Custom. Doing this opens a copy of the actual template so you can modify any part of the stack to perfectly fit your needs.
When working with a stack in this manner, you’ll have access to far more details to configure and a built-in web editor that allows you to modify the stack manifest (Figure D).
With this method, you can change environment variables, add new services to the stack, configure ports and more. After editing the template, click Create custom template and that new template will be listed in App Templates | Custom Templates. You can then click on the template and then click Deploy the Stack (Figure E) to deploy the application from the template.
Creating a custom template from scratch
You can also create a custom template from scratch. To do this, go to App Templates | Custom Templates and then click Add Custom Template. In the resulting window (Figure F), give the new template a title (must be all lower case) and a description.
With the details created, you then need to either use the Web Editor (Figure G–and write out your Docker-compose file), upload a Docker-compose file from local storage or retrieve the Docker-compose file from a Git repository.
Once you’ve completed the template, scroll to the bottom and click Create Custom Template to save your work. The new template will appear in the Custom Templates section, where you can open it and then deploy it.
And that’s all there is to use Application Templates in Portainer. This is a great way to get up to speed with creating full-stack applications and deploying/managing them with one of the best Docker GUIs on the market.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.