P
P
pawnoholic2019-04-12 17:06:48
Docker
pawnoholic, 2019-04-12 17:06:48

How to access by hostname from Docker container?

Unable to access from Docker container by Traefik hostname.

When executing a request from inside the container curl -l http://${SITE_DOMAIN_NAME}/, a timeout occurs.

docker-compose.yml:

spoiler
version: "3.7"

networks:
  default:
    external:
      name: "gateway"

services:
  traefik:
    image: traefik
    restart: always
    ports:
      - "80:80"
      - "443:443"
    networks:
      - default
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./traefik.toml:/etc/traefik/traefik.toml"
      - "${DATA_DIR}/traefik/acme/acme.json:/acme.json"
    labels:
      - "traefik.backend=traefik"
      - "traefik.frontend.rule=Host:traefik.${SITE_DOMAIN_NAME}"
      - "traefik.frontend.auth.basic.users=${AUTH_BASIC_USERS}"
      - "traefik.docker.network=gateway"
      - "traefik.port=8080"

  community:
    image: community
    restart: on-failure
    networks:
      - default
    volumes:
      - "${DATA_DIR}/community:/var/www/html"
    labels:
      - "traefik.enable=true"
      - "traefik.backend=community"
      - "traefik.frontend.rule=Host:${SITE_DOMAIN_NAME}"
      - "traefik.docker.network=gateway"
      - "traefik.port=80"

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question