# Issues using custom docker templates

**URL:** <https://community.traefik.io/t/issues-using-custom-docker-templates/1378>\
**Category:** Traefik v1\
**Tags:** docker\
**Created:** [August 29, 2019, 7:16pm UTC](https://community.traefik.io/t/issues-using-custom-docker-templates/1378 "2019-08-29T19:16:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![willg](https://avatars.discourse-cdn.com/v4/letter/w/f475e1/32.png) [@willg](https://community.traefik.io/u/willg)\
**Post date:** [August 29, 2019, 7:16pm UTC](https://community.traefik.io/t/issues-using-custom-docker-templates/1378/1 "2019-08-29T19:16:23Z")

</div>

I've been trying to figure out how to use custom docker templates (as described here [https://docs.traefik.io/configuration/commons/#override-default-configuration-template](https://docs.traefik.io/configuration/commons/#override-default-configuration-template)), but running into trouble when using the "stock" docker template for v1.7.14 ([https://github.com/containous/traefik/blob/v1.7.14/templates/docker.tmpl](https://github.com/containous/traefik/blob/v1.7.14/templates/docker.tmpl)). Namely, when I try to start traefik with that template verbatim, I get this errror:

```auto
traefik_1 | time="2019-08-29T18:58:33Z" level=error msg="template: /etc/traefik/docker.tmpl:6: function \"getCircuitBreaker\" not defined"
traefik_1 | time="2019-08-29T18:58:33Z" level=debug msg="Received nil configuration from provider \"docker\", skipping."

```

Seems that the default template references some undefined function. Is there another base template I should be using, or an example of a traefik setup which provides a working docker template?

Thanks!

---

<div class="post-metadata">

**Author:** ![ldez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/ldez/32/5_2.png) [@ldez](https://community.traefik.io/u/ldez)\
**Post date:** [August 29, 2019, 7:44pm UTC](https://community.traefik.io/t/issues-using-custom-docker-templates/1378/2 "2019-08-29T19:44:59Z")

</div>

Hello,

Try to add this in your configuration:

```auto
[docker]
  templateVersion = 2
  # ...

```

[https://docs.traefik.io/v1.7/configuration/backends/docker/](https://docs.traefik.io/v1.7/configuration/backends/docker/)

```auto
[docker]
# Override template version
# For advanced users :)
#
# Optional
# - "1": previous template version (must be used only with older custom templates, see "filename")
# - "2": current template version (must be used to force template version when "filename" is used)
#
# templateVersion = 2

```

---

<div class="post-metadata">

**Author:** ![willg](https://avatars.discourse-cdn.com/v4/letter/w/f475e1/32.png) [@willg](https://community.traefik.io/u/willg)\
**Post date:** [August 29, 2019, 10:36pm UTC](https://community.traefik.io/t/issues-using-custom-docker-templates/1378/3 "2019-08-29T22:36:11Z")

</div>

Thanks, that did it! FWIW I think the documentation could use a little clarification on this feature, since both version numbers claim they must be used and it's not clear which is the default value.

Separate question: do you know if Traefik 2 has a feature similar to templates which would allow for e.g. specifying default security headers?

---

<div class="post-metadata">

**Author:** ![ldez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/ldez/32/5_2.png) [@ldez](https://community.traefik.io/u/ldez)\
**Post date:** [August 29, 2019, 10:39pm UTC](https://community.traefik.io/t/issues-using-custom-docker-templates/1378/4 "2019-08-29T22:39:11Z")

</div>

Traefik v2 don't have any template.

The new design allow to do lot more thing than the v1 without using template.

The middleware can be define in a provider and applying on multiple routers.

- [https://docs.traefik.io/v2.0/middlewares/headers/](https://docs.traefik.io/v2.0/middlewares/headers/)
- [https://docs.traefik.io/v2.0/middlewares/overview/#provider-namespace](https://docs.traefik.io/v2.0/middlewares/overview/#provider-namespace)
