# Issue using external networks

**URL:** <https://community.traefik.io/t/issue-using-external-networks/2689>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [October 30, 2019, 7:49pm UTC](https://community.traefik.io/t/issue-using-external-networks/2689 "2019-10-30T19:49:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielb](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@danielb](https://community.traefik.io/u/danielb)\
**Post date:** [October 30, 2019, 7:49pm UTC](https://community.traefik.io/t/issue-using-external-networks/2689/1 "2019-10-30T19:49:54Z")

</div>

I am using external network in docker-compose, but Traefik does not seem to understand it and throws the following error:

```auto
time="2019-10-30T19:24:25Z" level=warning msg="Could not find network named 'frontend' for container '/qatar_qatarwordpress_1'! Maybe you're missing the project's prefix in the label? Defaulting to first available network." providerName=docker container=qatarwordpress-qatar-d9266c3831f946e6bdfc5f8ee1a765beb6f369a68ab54dc1d312adede2289fa4 serviceName=qatarwordpress-qatar

```

and when I try to access the site I get a Gateway timeout error.  
**Traefik docker-compose:**

```auto
version: '3.7'
services:
  traefik:
    image: traefik:latest
    volumes:
      # - ./traefik.toml:/etc/traefik/traefik.toml
      - /var/run/docker.sock:/var/run/docker.sock
      - "./letsencrypt/:/letsencrypt/"
      - "./logs/traefik.log:/traefik.log"
      - "./ssl/:/etc/traefik/ssl/"
      - "./dyn/:/dyn/"
      - "./traefik/:/opt/traefik/"
    restart: always
    networks:
      - frontend
    ports:
      - "80:80"
      - "443:443"
    command:
      - --api
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--metrics.prometheus=true"
      - "--global.sendAnonymousUsage=true"
      - "--entryPoints.web.address=:80"
      - "--entryPoints.websecure.address=:443"
      - "--log.level=DEBUG"
      - "--log.filepath=/opt/traefik/traefik.log"
      - "--accesslog=true"
      - "--accesslog.filepath=/opt/traefik/access.log"
      # Lets Encrypt settings:
      - "--certificatesresolvers.le.acme.dnschallenge=true"
      - "--certificatesresolvers.le.acme.dnschallenge.provider=route53"
      - "--certificatesresolvers.le.acme.email=webmaster@XXXXXXXXXX.com"
      - "--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json"
    environment:
      # Lets Encrypt- Route53 DNS Challenge settings
      - "AWS_HOSTED_ZONE_ID=XXXXXXXXX"
      - "AWS_ACCESS_KEY_ID=XXXXXXXXXX"
      - "AWS_SECRET_ACCESS_KEY=XXXXXXXXXX"
    labels:
      # global redirect to https
      - "traefik.http.routers.redirs.rule=hostregexp(`{host:.+}`)"
      - "traefik.http.routers.redirs.entrypoints=web"
      - "traefik.http.routers.redirs.middlewares=redirect-to-https"
      # middleware redirect
      - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
      # dashboard
      - "traefik.http.routers.traefik.rule=Host(`traefik.XXXXX.com`)"
      - "traefik.http.routers.traefik.service=api@internal"
      - "traefik.http.routers.traefik.tls.certresolver=le"
      - "traefik.http.routers.traefik.entrypoints=websecure"
      - "traefik.http.routers.traefik.middlewares=admin"
      - "traefik.http.middlewares.admin.basicauth.users=admin:XXXXXXXXXX" 

  whoami:
    image: "containous/whoami"
    container_name: "simple-service"
    networks:
      - frontend
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.whoami.rule=Host(`whoami.XXXXXXXXXX.com`)"
      - "traefik.http.routers.whoami.entrypoints=websecure"
      - "traefik.http.routers.whoami.tls.certresolver=le"
      - "traefik.http.routers.whoami.middlewares=auth"
      - "traefik.http.middlewares.auth.basicauth.users=myuser:XXXXXXXXXX"
networks:
  frontend:
    external:
      name: traefik-proxy

```

**Wordpress docker-compose:**

```auto
version: '3.7'
services:
  #Database
  db:
    image: mysql:latest
    volumes:
      - ./db_data:/var/lib/mysql
    restart: always
    networks:
      - backend
    command: mysqld --default_authentication_plugin=mysql_native_password
    environment:
      MYSQL_ROOT_PASSWORD: wordpress
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress

  #WordPress
  qatarwordpress:
    depends_on:
      - db
    image: wordpress:latest
    restart: always
    networks:
      - frontend
      - backend
    volumes:
      - ./html:/var/www/html
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=frontend"
      - "traefik.http.routers.wordpress.rule=Host(`qatar.XXXXXXXXXX.com`)"
      - "traefik.http.routers.wordpress.entrypoints=websecure"
      - "traefik.http.routers.wordpress.tls.certresolver=le"
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress

networks:
  backend:
  frontend:
    external:
      name: traefik-proxy

```

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![zespri](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/zespri/32/310_2.png) [@zespri](https://community.traefik.io/u/zespri)\
**Post date:** [November 2, 2019, 6:40am UTC](https://community.traefik.io/t/issue-using-external-networks/2689/2 "2019-11-02T06:40:15Z")

</div>

The error message indicates that you don't have a network called `frontend`.

Run `docker network ls` to view the list of available networks. More information on [Networking in Compose](https://docs.docker.com/compose/networking/)

---

<div class="post-metadata">

**Author:** ![danielb](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@danielb](https://community.traefik.io/u/danielb)\
**Post date:** [November 3, 2019, 3:38am UTC](https://community.traefik.io/t/issue-using-external-networks/2689/3 "2019-11-03T03:38:51Z")

</div>

I know I don't have a network called frontend... my network is call traefik-proxy and is listed as an external network at the bottom of both compose files:

```auto
frontend:
    external:
      name: traefik-proxy

```

So it should be looking for a network named traefik-proxy and not one named frontend

---

<div class="post-metadata">

**Author:** ![zespri](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/zespri/32/310_2.png) [@zespri](https://community.traefik.io/u/zespri)\
**Post date:** [November 3, 2019, 4:04am UTC](https://community.traefik.io/t/issue-using-external-networks/2689/4 "2019-11-03T04:04:27Z")

</div>

> [@danielb](#):
>
> So it should be looking for a network named traefik-proxy and not one named frontend

That's what threw you off the track... - it's wrong expectation.

---

<div class="post-metadata">

**Author:** ![danielb](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@danielb](https://community.traefik.io/u/danielb)\
**Post date:** [November 4, 2019, 1:41am UTC](https://community.traefik.io/t/issue-using-external-networks/2689/5 "2019-11-04T01:41:06Z")

</div>

Why is that the wrong expectation? It is an External Network and I explicitly listed that its external name is traefik-proxy.... This works for other docker'ed apps, what am I supposed to do to tell traefik that it needs to use the external networked named traefik-proxy?

---

<div class="post-metadata">

**Author:** ![zespri](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/zespri/32/310_2.png) [@zespri](https://community.traefik.io/u/zespri)\
**Post date:** [November 4, 2019, 3:22am UTC](https://community.traefik.io/t/issue-using-external-networks/2689/6 "2019-11-04T03:22:16Z")

</div>

Sorry, what "works for other docker'ed apps"? Can you give an example?

> [@danielb](#):
>
> Why is that the wrong expectation?

Because it does not align with reality of traefik implementation.

> [@danielb](#):
>
> what am I supposed to do to tell traefik that it needs to use the external networked named traefik-proxy?

I hinted at that in my initial answer: run `docker network ls` and chose a network that is listed there, it cannot use a network that does not exist.

---

<div class="post-metadata">

**Author:** ![danielb](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@danielb](https://community.traefik.io/u/danielb)\
**Post date:** [November 4, 2019, 1:46pm UTC](https://community.traefik.io/t/issue-using-external-networks/2689/7 "2019-11-04T13:46:11Z")

</div>

I have used a network that exists... I happens to be an External network... are you saying that Traefik does not support External networks in docker-compose?

---

<div class="post-metadata">

**Author:** ![CVJoint](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cvjoint/32/642_2.png) [@CVJoint](https://community.traefik.io/u/CVJoint)\
**Post date:** [November 5, 2019, 4:48am UTC](https://community.traefik.io/t/issue-using-external-networks/2689/8 "2019-11-05T04:48:23Z")

</div>

Hello,

I used to call my network out in a similar way, but I believe that is an older way to name the network (I could be wrong). I'm now calling `external: true` - something like:

```auto
    networks:
      - traefik-proxy
      - backend

networks:
  backend:
  traefik-proxy:
    external: true

```

This identifies two networks for this compose file **backend** and **traefik-proxy** (which is external). You'll have to edit your Traefik compose file in a similar fashion. Could you give this a try?

---

<div class="post-metadata">

**Author:** ![zespri](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/zespri/32/310_2.png) [@zespri](https://community.traefik.io/u/zespri)\
**Post date:** [November 5, 2019, 5:09am UTC](https://community.traefik.io/t/issue-using-external-networks/2689/9 "2019-11-05T05:09:12Z")

</div>

@danielb change `"traefik.docker.network=frontend"` to `"traefik.docker.network=traefik-proxy"`

---

<div class="post-metadata">

**Author:** ![danielb](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@danielb](https://community.traefik.io/u/danielb)\
**Post date:** [November 5, 2019, 2:48pm UTC](https://community.traefik.io/t/issue-using-external-networks/2689/10 "2019-11-05T14:48:48Z")

</div>

> [@zespri](#):
>
> change `"traefik.docker.network=frontend"` to `"traefik.docker.network=traefik-proxy"`

That was it... I was completely overlooking that line... I was focused on the standard docker-compose lines...

Thank you
