Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker deploy -c example.yml e #1169

Closed
lvnilesh opened this issue Feb 16, 2017 · 2 comments
Closed

docker deploy -c example.yml e #1169

lvnilesh opened this issue Feb 16, 2017 · 2 comments

Comments

@lvnilesh
Copy link

lvnilesh commented Feb 16, 2017

Thanks for Traefik.

What version of Traefik are you using (traefik version)?

Traefik version v1.1.2 built on 2016-12-15_10:21:15AM

What is your environment & configuration (arguments, toml...)?

What did you do?

I am following https://docs.traefik.io/user-guide/swarm-mode/ and it works.

Now I create a example.yml described below and it does not.

What did you expect to see?

I expect curl to work like https://docs.traefik.io/user-guide/swarm-mode/

What did you see instead?

404

I am following https://docs.traefik.io/user-guide/swarm-mode/ and it works now I create example.yml like this.

version: "3"

networks:
    traefik-net:
      external: true

volumes:
    data:

services:

    whoami0:
      image: emilevauge/whoami
      networks:
        - traefik-net
      labels:
        - "traefik.port=80"
        - "traefik.docker.network=traefik-net"
        - "traefik.backend=e_whoami0"
        - "traefik.frontend.rule=Host:whoami0.traefik"

    whoami1:
      image: emilevauge/whoami
      networks:
        - traefik-net
      labels:
        - "traefik.port=80"
        - "traefik.docker.network=traefik-net"
        - "traefik.backend=e_whoami1"
        - "traefik.frontend.rule=Host:whoami1.traefik"
        - "traefik.backend.loadbalancer.sticky=true"

    traefik:
      image: traefik
      command: -c /dev/null --web --docker --docker.swarmmode --docker.watch --docker.domain=traefik --logLevel=DEBUG
      networks:
        - traefik-net
      ports:
        - "80:80"
        - "8080:8080"
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
      deploy:
        placement:
          constraints: [node.role == manager]

and deploy docker deploy -c example.yml. e

I also edited /etc/hosts

51.15.132.133   whoami1.traefik
51.15.132.133   whoami0.traefik

so I am able to see http://whoami0.traefik:8080/dashboard/#!/health
and visualizer is http://51.15.132.133:8000 and Traefic dashboard is http://51.15.132.133:8080

but http://51.15.132.133 and http://whoami0.traefik and http://whoami1.traefik show 404.

curl -H Host:whoami0.traefik http://$(docker-machine ip manager) shows 404 page not found.

What am I missing?

docker logs traefic https://gist.github.com/lvnilesh/55ec9646e13ec262a107489dc4ea1efe
docker inspect e_whoami0 https://gist.github.com/lvnilesh/f100db43a3b6b0896d95188e2e93b834
docker service inspect e_traefic https://gist.github.com/lvnilesh/22ac8fed4c20d71c812c7f5ef129632a

@lvnilesh lvnilesh changed the title docker deploy -c example docker deploy -c example.yml e Feb 16, 2017
@bvis
Copy link

bvis commented Feb 17, 2017

I think you just need to modify your stack like this:

version: "3"

networks:
    traefik-net:
      external: true

volumes:
    data:

services:

    whoami0:
      image: emilevauge/whoami
      networks:
        - traefik-net
      deploy:
        labels:
          - "traefik.port=80"
          - "traefik.docker.network=traefik-net"
          - "traefik.backend=e_whoami0"
          - "traefik.frontend.rule=Host:whoami0.traefik"

    whoami1:
      image: emilevauge/whoami
      networks:
        - traefik-net
      deploy:
        labels:
          - "traefik.port=80"
          - "traefik.docker.network=traefik-net"
          - "traefik.backend=e_whoami1"
          - "traefik.frontend.rule=Host:whoami1.traefik"
          - "traefik.backend.loadbalancer.sticky=true"

    traefik:
      image: traefik
      command: -c /dev/null --web --docker --docker.swarmmode --docker.watch --docker.domain=traefik --logLevel=DEBUG
      networks:
        - traefik-net
      ports:
        - "80:80"
        - "8080:8080"
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
      deploy:
        placement:
          constraints: [node.role == manager]

In compose v3 there are two different type of labels:

  • Container labels:

    • First level in the service definition.
    • Not used by traefik.
    • In docker service create are added as --container-label
  • Service labels

    • Are inside the deploy definition.
    • Used by traefik.
    • In docker service create are identified as --label

@lvnilesh
Copy link
Author

Awesome! Thanks for a quick resolution.

I going to attempt to deploy real apps in a multi-node swarm now. Thank you very much.

@traefik traefik locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants