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

Comments: Traefik on Docker for Web Developers #13

Open
jtreminio opened this issue Dec 17, 2018 · 10 comments
Open

Comments: Traefik on Docker for Web Developers #13

jtreminio opened this issue Dec 17, 2018 · 10 comments

Comments

@jtreminio
Copy link
Owner

https://jtreminio.com/blog/traefik-on-docker-for-web-developers/

@Lemmork
Copy link

Lemmork commented Feb 18, 2019

Hi, thanks for this great post, which works fine for my http connection.
I'm wondering if I can have http and https on .localhost.
I tried some label settings like this to access my container on port 80 and 443:

      - traefik.docker.network=traefik_webgateway
      - traefik.app.frontend.rule=Host:project.localhost
      - traefik.app.backend=web-http
      - traefik.port=80
      - traefik.frontend.entryPoints=http
      - traefik.https.frontend.rule=Host:project.localhost
      - traefik.https.port=443
      - traefik.https.frontend.entryPoints=https
      - traefik.https.backend=web-https

But this does not work. If I try to access https://project.localhost I get an ERR_CONNECTION_RESET in Chrome.
I'm not sure, if chrome does a loopback on https at all, or if I have a misconfiguration in traefik.

@jtreminio
Copy link
Owner Author

@Lemmork Let's Encrypt will not work on a private (local) hostname unless DNS is pointed to your computer's IP.

In other words, too much hassle. I recommend creating a real subdomain on your project's public website, like dev.mysite.com, and creating an SSL cert for that subdomain, then using that cert for local development.

@Lemmork
Copy link

Lemmork commented Feb 25, 2019

Finaly I solved it by terminating ssl on treafik with a self-signed certificate.

version:  '3.5'

services:
  proxy:
    image: traefik
    command: --api --docker --docker.domain=docker.localhost --defaultentrypoints=http,https --entryPoints='Name:http Address::80 Redirect.EntryPoint:https' --entryPoints='Name:https Address::443 TLS:/ssl/localhost.crt,/ssl/localhost.key.pem' --logLevel=DEBUG
    networks:
      - webgateway
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /dev/null:/traefik.toml
      - ./ssl:/ssl
networks:
  webgateway:
    driver: bridge

@kidpixo
Copy link

kidpixo commented Jul 14, 2019

Great article, thanks! The TCP issue seems to be closed and resolved now in containous/traefik #4587.
I must definitely start using traefik, you convinced me.

@kidpixo
Copy link

kidpixo commented Jul 14, 2019

Just another question : how do you include the comments here on the jekyll generated website???

@speto
Copy link

speto commented Jul 23, 2019

If you would like to get rid of usual port dance with databases you could try this simple utility speto/docker-db-tunnel

@tenshi13
Copy link

tenshi13 commented Jan 5, 2020

Hi there, thank you first for this great post, am playing with traefik and was doing tutorials, your post was real helpfull. Would like to just notify, it seems that some of the commands might be outdated with latest traefik docker image, to spin a container with working dashboard up now needs:

docker container run -d --name traefik_proxy \
    --network traefik_webgateway \
    -p 80:80 \
    -p 8080:8080 \
    --restart always \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    --volume /dev/null:/dyn-traefik.toml \
    traefik --api.dashboard=true --api.insecure=true --providers.docker

note:

  • traefik.toml => dyn-traefik.toml
  • --api => --api.dashboard=true --api.insecure=true
  • --docker => --providers.docker

if not, i believe the version for when you wrote the tutorial was v1.7, you can hard version it to that also maybe :D

please keep on writing awesome posts!

@tenshi13
Copy link

tenshi13 commented Jan 5, 2020

@kidpixo I was curious also and I believe it would be the js magic at jtreminio.com/static/js/gh-commentify.js

@majidalikhn
Copy link

Hi, thanks for this great post, which works fine for my http connection.
I'm wondering if I can have http and https on .localhost.
I tried some label settings like this to access my container on port 80 and 443:

      - traefik.docker.network=traefik_webgateway
      - traefik.app.frontend.rule=Host:project.localhost
      - traefik.app.backend=web-http
      - traefik.port=80
      - traefik.frontend.entryPoints=http
      - traefik.https.frontend.rule=Host:project.localhost
      - traefik.https.port=443
      - traefik.https.frontend.entryPoints=https
      - traefik.https.backend=web-https

But this does not work. If I try to access https://project.localhost I get an ERR_CONNECTION_RESET in Chrome.
I'm not sure, if chrome does a loopback on https at all, or if I have a misconfiguration in traefik.

@Lemmork I have run across a similar issue, is there any chance you can help me? Could you share your .toml file?

@Lemmork
Copy link

Lemmork commented Jan 7, 2021

@majidalikhn The traefik version I used two years ago is outdated now. Maybe this is why you are having trouble with it. If you want to use https on localhost you need to provide a self-signed certificate.
Maybe this works with the newer version too:
#13 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants