Traefik没有显示IP地址

时间:2018-01-06 18:41:33

标签: docker docker-compose traefik

我是Docker的新手,我正在尝试使用docker4wordpress来使用/配置Docker。

但是我没有获得Traefik的任何IP地址如果我正确的思考,我应该获取服务器公共IP地址 - 我在Linode服务器上运行它。然后,我应该可以通过portainer.sub.domain.co.nz:port访问。

turtle_traefik_1     /traefik -c /dev/null --we ...   Up      0.0.0.0:8000->80/tcp

作曲家文件:

version: "2"

services:
  mariadb:
    image: wodby/mariadb:10.2-3.0.2
#    image: wodby/mariadb:10.1-3.0.2
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress
#    volumes:
#      - ./mariadb-init:/docker-entrypoint-initdb.d # Place init .sql file(s) here.
#      - /path/to/mariadb/data/on/host:/var/lib/mysql # I want to manage volumes manually.

#  postgres:
#    image: wodby/postgres:10.1-1.2.0
##    image: wodby/postgres:9.6-1.2.0
#    environment:
#      POSTGRES_PASSWORD: password
#      POSTGRES_DB: wordpress
#      POSTGRES_USER: wordpress
#    volumes:
#      - ./postgres-init:/docker-entrypoint-initdb.d # Place init file(s) here.
#      - /path/to/postgres/data/on/host:/var/lib/postgresql/data # I want to manage volumes manually.

  php:
# 1. Images with vanilla WordPress – wodby/wordpress:[WP_VERSION]-[PHP_VERSION]-[STABILITY_TAG].
    image: wodby/wordpress:4-7.2-3.3.1
#    image: wodby/wordpress:4-7.1-3.3.1
#    image: wodby/wordpress:4-7.0-3.3.1
#    image: wodby/wordpress:4-5.6-3.3.1
# 2. Images without WordPress – wodby/wordpress-php:[PHP_VERSION]-[STABILITY_TAG].
#    image: wodby/wordpress-php:7.2-3.3.1
#    image: wodby/wordpress-php:7.1-3.3.1
#    image: wodby/wordpress-php:7.0-3.3.1
#    image: wodby/wordpress-php:5.6-3.3.1
# 3. Images without WordPress – wodby/wordpress-php:[PHP_VERSION]-[STABILITY_TAG].Version for development (--enable-debug)
#    image: wodby/wordpress-php:7.2-dev-3.3.1
#    image: wodby/wordpress-php:7.1-dev-3.3.1
#    image: wodby/wordpress-php:7.0-dev-3.3.1
#    image: wodby/wordpress-php:5.6-dev-3.3.1
    environment:
      PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
      PHP_FPM_CLEAR_ENV: "no"
#      PHP_XDEBUG: 1
#      PHP_XDEBUG_DEFAULT_ENABLE: 1
#      PHP_XDEBUG_REMOTE_CONNECT_BACK: 0
#      PHP_XDEBUG_REMOTE_HOST: "10.254.254.254"
#      PHP_XDEBUG_PROFILER_OUTPUT_DIR: /mnt/files/xdebug/profiler
#      PHP_XDEBUG_TRACE_OUTPUT_DIR: /mnt/files/xdebug/traces
    volumes:
      - codebase:/var/www/html
## Options for macOS users (http://docs.docker4wordpress.org/en/latest/macos)
#      - codebase:/var/www/html:cached # User-guided caching
#      - docker-sync:/var/www/html # Docker-sync
## For Xdebug profiler files
#      - files:/mnt/files

  nginx:
    image: wodby/wordpress-nginx:4-1.13-3.0.2
#    image: wodby/wordpress-nginx:4-1.12-3.0.2
    environment:
      NGINX_STATIC_CONTENT_OPEN_FILE_CACHE: "off"
      NGINX_ERROR_LOG_LEVEL: debug
      NGINX_BACKEND_HOST: php
    volumes:
      - codebase:/var/www/html
# Options for macOS users (http://docs.docker4wordpress.org/en/latest/macos)
#      - codebase:/var/www/html:cached # User-guided caching
#      - docker-sync:/var/www/html # Docker-sync
    depends_on:
      - php
    labels:
      - 'traefik.backend=nginx'
      - 'traefik.port=80'
      - 'traefik.frontend.rule=Host:sub.domain.co.nz'

#  apache:
#    image: wodby/php-apache:2.4-2.0.2
#    depends_on:
#      - php
#    environment:
#      APACHE_LOG_LEVEL: debug
#      APACHE_BACKEND_HOST: php
#      APACHE_SERVER_ROOT: /var/www/html
#    volumes:
#      - codebase:/var/www/html
## Options for macOS users (http://docs.docker4wordpress.org/en/latest/macos)
##      - codebase:/var/www/html:cached # User-guided caching
##      - docker-sync:/var/www/html # Docker-sync
#    labels:
#      - 'traefik.backend=apache'
#      - 'traefik.port=80'
#      - 'traefik.frontend.rule=Host:sub.domain.co.nz'

  varnish:
    image: wodby/wordpress-varnish:4.1-2.3.1
    depends_on:
      - nginx
    environment:
      VARNISH_SECRET: secret
      VARNISH_BACKEND_HOST: nginx
      VARNISH_BACKEND_PORT: 80
    labels:
      - 'traefik.backend=varnish'
      - 'traefik.port=6081'
      - 'traefik.frontend.rule=Host:varnish.sub.domain.co.nz'

#  redis:
    image: wodby/redis:4.0-2.1.4
#    image: wodby/redis:3.2-2.1.4

#  pma:
#    image: phpmyadmin/phpmyadmin
#    environment:
#      PMA_HOST: mariadb
#      PMA_USER: wordpress
#      PMA_PASSWORD: wordpress
#      PHP_UPLOAD_MAX_FILESIZE: 1G
#      PHP_MAX_INPUT_VARS: 1G
#    labels:
#      - 'traefik.backend=pma'
#      - 'traefik.port=80'
#      - 'traefik.frontend.rule=Host:pma.tinyturtles.co.nz'

#  athenapdf:
#    image: arachnysdocker/athenapdf-service:2.10.0
#    environment:
#      WEAVER_AUTH_KEY: weaver-auth-key
#      WEAVER_ATHENA_CMD: "athenapdf -S"
#      WEAVER_MAX_WORKERS: 10
#      WEAVER_MAX_CONVERSION_QUEUE: 50
#      WEAVER_WORKER_TIMEOUT: 90
#      WEAVER_CONVERSION_FALLBACK: false

#  blackfire:
#    image: blackfire/blackfire
#    environment:
#      BLACKFIRE_SERVER_ID: XXXXX
#      BLACKFIRE_SERVER_TOKEN: YYYYY

#  webgrind:
#    image: wodby/webgrind:1.5-1.0.0
#    environment:
#      WEBGRIND_PROFILER_DIR: /mnt/files/xdebug/profiler
#    labels:
#      - 'traefik.backend=webgrind'
#      - 'traefik.port=8080'
#      - 'traefik.frontend.rule=Host:webgrind.sub.domian.co.nz'
#    volumes:
#      - files:/mnt/files

  #mailhog:
   #image: mailhog/mailhog
    #labels:
     # - 'traefik.backend=mailhog'
      #- 'traefik.port=8025'
      #- 'traefik.frontend.rule=Host:mailhog.sub.domian.co.nz'

  portainer:
    image: portainer/portainer
    command: --no-auth -H unix:///var/run/docker.sock
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      - 'traefik.backend=portainer'
      - 'traefik.port=9000'
      - 'traefik.frontend.rule=Host:portainer.sub.domain.co.nz'

  traefik:
    image: traefik
    command: -c /dev/null --web --docker --logLevel=INFO
    ports:
      - '8000:80'
#      - '8080:8080' # Dashboard
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

volumes:
  codebase:
## Docker-sync for macOS users
#  docker-sync:
#    external: true
## For Xdebug profiler
#  files:

2 个答案:

答案 0 :(得分:1)

0.0.0.0:8000->80/tcp

0.0.0.0表示主机上的“所有IPv4接口”。这包括环回(127.0.0.1),以及您拥有的任何其他IP(LAN,Wifi)。

8000->80/tcp表示docker会将主机TCP端口8000上的请求转发到容器的TCP端口80.

您应该能够与http://127.0.0.1:8000联系到traefik。

答案 1 :(得分:0)

0.0.0.0:8000->80/tcp 

这意味着您的容器在localhost上运行,目标端口8000并发布80,您可以通过以下方式访问您的wordpress:

http://localhost
http://127.0.0.1