# Unable to expose Docker Container

**URL:** <https://community.traefik.io/t/unable-to-expose-docker-container/3863>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [January 15, 2020, 12:24am UTC](https://community.traefik.io/t/unable-to-expose-docker-container/3863 "2020-01-15T00:24:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amigo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/amigo/32/2411_2.png) [@amigo](https://community.traefik.io/u/amigo)\
**Post date:** [January 15, 2020, 12:24am UTC](https://community.traefik.io/t/unable-to-expose-docker-container/3863/1 "2020-01-15T00:24:17Z")

</div>

I tried running a Docker container that ran a flask application. It works when I do

```auto
curl 0.0.0.0:50000

```

Since I get a response of the webpage. However, I'm unable to access it through my domain.

Currently on Traefik  
v2.1.2

My docker-compose file is similar to the following:

```auto
version: "3"

networks:
  proxy:
    external: true
  internal:
    external: false
services:

  hog:
    # The official v2.0 Traefik docker image
    image: traefik:v2.1.2
    # Enables the web UI and tells Traefik to listen to docker
    command:
      - --entrypoints.web.address=:80
      - --providers.docker
      - --api
      - --ping=true
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - proxy
    labels:
      - "traefik.http.routers.api.rule=Host(`subdomain.domain.tld`)"
      - "traefik.http.routers.api.service=api@internal"
      - "traefik.http.routers.api.middlewares=auth"
      - "traefik.http.middlewares.auth.basicauth.users=admin:password"

  some-container:
    image: username/some-container:latest
    restart: always
    labels:
      - traefik.http.routers.some-container.rule=Host(`subdomain.domain.tld`)
      - traefik.http.services.some-container.loadbalancer.server.port=50000
    networks:
      - proxy
      - internal

```

It shows up in the dashboard fine, but I'm thinking that because I didn't specify the entrypoint may be the problem. _But_ interestingly, when I run the following (in the same docker-compose file):

```auto
  ghost:
    image: ghost:latest
    restart: always
    ports:
      - 2367-2368:2368
    environment:
      url: http://subdomain.domain.tld
      database__client: sqlite3
    networks:
      - proxy
    labels:
      - traefik.http.routers.ghost.rule=Host(`subdomain.domain.tld`)
    volumes:
      - some volume
    deploy:

```

It works perfectly. I'm thinking that maybe because I have around 20 services using the same entrypoint, this may cause the problem? Not completely sure. Will update if I fix this problem.

---

<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:** [January 15, 2020, 12:56am UTC](https://community.traefik.io/t/unable-to-expose-docker-container/3863/2 "2020-01-15T00:56:56Z")

</div>

Hello,

you can put a lot more routers than that on an entry point, so It's clearly not the problem.

As you have only one entry point you don't need to specify it.

on `some-container` I can see 3 possible problems:

- you are using multiple networks [https://docs.traefik.io/v2.1/routing/providers/docker/#traefikdockernetwork](https://docs.traefik.io/v2.1/routing/providers/docker/#traefikdockernetwork)
- you are using the same rule everywhere `Host(`subdomain.domain.tld`)` (I know that you have obfuscated the domains, but with your sample I can't say if it's related to that or not)
- maybe the port set by `traefik.http.services.some-container.loadbalancer.server.port=50000` is wrong

---

<div class="post-metadata">

**Author:** ![amigo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/amigo/32/2411_2.png) [@amigo](https://community.traefik.io/u/amigo)\
**Post date:** [January 15, 2020, 1:22am UTC](https://community.traefik.io/t/unable-to-expose-docker-container/3863/3 "2020-01-15T01:22:19Z")

</div>

Updated my docker compose file:

```auto
  some-container:
    image: name/some-container
    restart: always
    expose:
      - 4999
    ports:
      - 4999:4999
    labels:
      - traefik.http.routers.some-container.rule=Host(`run.domain.dev`)
      - traefik.http.services.some-container.loadbalancer.server.port=4999
    networks:
      - proxy

```

So I basically stripped it down and it does work! _but_ The weird thing is that when I use my domain.dev domain instead of [domain.io](http://domain.io) domain, it doesn't work.

This is really puzzling as I have the same exact A records (basically the **run** subdomain is pointed to IP address 1.2.3.4 for both domain.dev and [domain.io](http://domain.io)) on both domain.dev and [domain.io](http://domain.io), but the domain.dev doesn't work (doesn't even connect).

I'll see if I can investigate, but could this be a potential Traefik issue? I really can't see how this isn't.

---

<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:** [January 15, 2020, 1:23am UTC](https://community.traefik.io/t/unable-to-expose-docker-container/3863/4 "2020-01-15T01:23:35Z")

</div>

It's not a Traefik issue, it's a configuration issue.

FYI you don't need to use `expose` and `ports`.

---

<div class="post-metadata">

**Author:** ![amigo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/amigo/32/2411_2.png) [@amigo](https://community.traefik.io/u/amigo)\
**Post date:** [January 15, 2020, 1:25am UTC](https://community.traefik.io/t/unable-to-expose-docker-container/3863/5 "2020-01-15T01:25:35Z")

</div>

Yeah I know. Just did it make it work. Will fix configs later.

I'll try again and figure out why I'm getting this, but thanks! I think my initial config would've worked if I used my .io domain and I'll test that out now.
