0

I have an application where we use the subdomain string to specify which team a customer belongs to.

For example:
customer1.ourdomain.com
customer2.ourdomain.com
... etc

Behind the scenes in our application we are parsing the string customerX from the origin URL to retrieve the customer's appropriate data.

When I run a docker container from the cli without compose, like the below, I am able to connect to my container and have the expected behavior:

docker run -d -p 7000:7000 MyApplicationImage:latest   

However, when I try to access this same behavior through the means of the docker-compose.yaml:

docker stack deploy -c docker-compose.yaml MyApplication`

My browser will not connect and times out/hangs.

Essentially: localhost:7070 -> works teamName.localhost:7070 -> Does not connect

This is what my docker-compose.yaml file looks like as of right now:

version: "3"
    services:
        sone:
          image: MyApplicationImage:latest
          deploy:
            replicas: 1
            restart_policy:
              condition: on-failure
          ports:
           - "7000:7000"
          networks:
            - webnet
        stwo:
          image: myimagetwo:latest
          deploy:
            replicas: 1
            restart_policy:
              condition: on-failure
          ports:
            - "7001:7001"
          networks:
            - webnet
   networks:
      webnet:
  • Are myImage and MyApplicationImage the same? – Robert May 22 '17 at 02:49
  • @Robert, yes that was a typo. I apologize. I edited the original post to reflect these changes. – nicolascoding May 22 '17 at 02:53
  • I am surprised how you are able to reach "teamName.localhost:7070 " with docker run -d -p 7000:7000 MyApplicationImage:latest. Running a container either with "docker run" or "docker compose" does not have any impact on the host's dns entries. The only way to expose this detail to host is to use a central dns service like consul and have host access that detail. containers in the same network can access the dns entries and it gets updated automatically. – Sreeni Jun 11 '17 at 06:51

0 Answers0