# Migrating minimal v1 traefik docker configuration to v2

**URL:** <https://community.traefik.io/t/migrating-minimal-v1-traefik-docker-configuration-to-v2/4926>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [March 15, 2020, 12:04am UTC](https://community.traefik.io/t/migrating-minimal-v1-traefik-docker-configuration-to-v2/4926 "2020-03-15T00:04:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nolan](https://avatars.discourse-cdn.com/v4/letter/n/aeb1de/32.png) [@nolan](https://community.traefik.io/u/nolan)\
**Post date:** [March 15, 2020, 12:04am UTC](https://community.traefik.io/t/migrating-minimal-v1-traefik-docker-configuration-to-v2/4926/1 "2020-03-15T00:04:22Z")

</div>

Hello everyone,

I am having troubles (as in `I have been banging my head at the terminal for three hours` troubles) migrating a simple v1 Traefik to its v2 equivalent:

```yaml
# docker-compose.yml
networks:
  default:
    external: 
      name: traefik

services:
  reverse-proxy:
    command: --api --docker
    container_name: traefik
    image: traefik:1.7.12-alpine
    labels:
      - traefik.backend='traefik'
      - traefik.frontend.entryPoints=http
      - traefik.frontend.rule=Host:traefik.localhost
      - traefik.port=8080
    ports:
      - "80:80"
    volumes:
      - $PWD/traefik.toml:/traefik.toml
      - /var/run/docker.sock:/var/run/docker.sock

version: '3.4'

```

```auto
# traefik.toml
defaultEntryPoints = ["http"]
[entryPoints]
  [entryPoints.http]
  address = ":80"
[docker]
exposedbydefault = true
watch=true

```

This setup simply creates a container that makes the traefik dashboard accessible from [http://traefik.localhost](http://traefik.localhost)

What would the Traefik v2 equivalent be like ?

Thank you for your comments and reading.

---

<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:** [March 15, 2020, 1:19am UTC](https://community.traefik.io/t/migrating-minimal-v1-traefik-docker-configuration-to-v2/4926/2 "2020-03-15T01:19:47Z")

</div>

Hello,

the equivalent with Traefik v2:

```auto
version: '3.7'

services:

  traefik:
    image: traefik:v2.1.6
    command:
      - --providers.docker
      - --entrypoints.web.address=:80
      - --api
    ports:
      - 80:80
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      # Dashboard
      traefik.http.routers.traefik.rule: Host(`traefik.localhost`)
      traefik.http.routers.traefik.entrypoints: web
      traefik.http.routers.traefik.service: api@internal

```

Recommend read:

- [https://blog.containo.us/traefik-2-0-docker-101-fc2893944b9d](https://blog.containo.us/traefik-2-0-docker-101-fc2893944b9d)
- [https://docs.traefik.io/v2.1/operations/dashboard/#secure-mode](https://docs.traefik.io/v2.1/operations/dashboard/#secure-mode)
- [https://github.com/containous/blog-posts/tree/master/2019\_09\_10-101\_docker](https://github.com/containous/blog-posts/tree/master/2019_09_10-101_docker)

---

<div class="post-metadata">

**Author:** ![nolan](https://avatars.discourse-cdn.com/v4/letter/n/aeb1de/32.png) [@nolan](https://community.traefik.io/u/nolan)\
**Post date:** [March 15, 2020, 1:53am UTC](https://community.traefik.io/t/migrating-minimal-v1-traefik-docker-configuration-to-v2/4926/3 "2020-03-15T01:53:15Z")

</div>

Thank you. I had finally made it work with this configuration (no entrypoints though):

```auto
# docker-compose.yml
networks:
  default:
    external: 
      name: traefik

services:
  reverse-proxy:
    container_name: traefik
    command: --api.insecure=true --providers.docker=true 
    image: traefik:2.1
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      - traefik.http.routers.api.rule=Host(`traefik.localhost`)
      - traefik.http.routers.api.service=api@internal

version: '3.4'

```

I'll be reading you recommendations.

---

<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:** [March 15, 2020, 9:47am UTC](https://community.traefik.io/t/migrating-minimal-v1-traefik-docker-configuration-to-v2/4926/4 "2020-03-15T09:47:36Z")

</div>

Don't use `--api.insecure=true` and `api@internal`: as you are using `api@internal` you don't need to use the insecure mode.
