Applying templates aborted on CLI (Docker)

Hi everyone,

I’m using InfluxDB 2 OSS for a work project and have it installed in a docker container. Everything went fine until I started working with templates.

I can import templates in the web interface (Settings → Templates) and I can export my modified templates to a file (into a bind mount in docker) BUT i cant reimport the exported template from file into a fresh container. Attempting to do so fails with: “aborted application of template” although I’m also getting the following info from the database:

ts=2021-11-02T12:31:32.257567Z lvl=info msg=“template dry run successful” log_id=0X_9DdCW000 service=pkger num_buckets=2 num_checks=4 num_dashboards=1 num_endpoints=1 num_labels=1 num_label_mappings=1 num_rules=1 took=206.087ms

Command I’m using:
docker exec influxdb2 influx apply -o MyOrg -f /templates/template.yml

I’ve also tried appending my admin token to the command with a -t and --token but without any luck.

Any help would be appreciated,
a frustrated intern

What kind of templates are you trying to re-import?

I’m able to import fairly simple templates into a fresh docker container without issue, so I’m wondering if there’s should about the template itself that you are trying to import.

The template was/is a mashup of the linux system + docker templates. Turns out that influx apply requires you to answer a prompt before applying the template for real. So adding -it to the command fixed it.

docker exec -it influxdb2 influx apply -o MyOrg -f /templates/template.yml

You could also use --force yes option, e.g.

docker exec influxdb2 influx apply -o MyOrg -f /templates/template.yml --force yes