Actions represents the data evaluations, functions or control loops. Templates are provided to the appropriate functions either as string or as “raw string”. Actionsīefore we learn how to implement it, let’s take a look at template’s syntax. It must be a valid Go template, and can use sprig. In this article we’re going to take a quick look on how to use the package, as well as how to integrate them with your application. The defaultRule option defines what routing rule to apply to a container if no rule is defined by a label. ![]() Both provide the same interface, however the html/template package is used to generate HTML output safe against code injection. All of these examples use the docker inspect command, but many other CLI commands have a -format flag, and many of the CLI command references include examples. Docker provides a set of basic functions to manipulate template elements. When you include the -format flag, Docker will send the command’s output through the Go template string you provide. Docker uses Go templates which you can use to manipulate the output format of certain commands and log drivers. ![]() ![]() You can use it with docker inspect and commands that produce lists of items, such as docker ps, docker images, and docker volumes. There’re two packages operating with templates - text/template and html/template. The -format flag is supported by most commonly used docker commands. Go templates are a powerful method to customize output however you want, whether you’re creating a web page, sending an e-mail, working with Buffalo, Go-Hugo, or just using some CLI such as kubectl.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |