Home > database >  Zabbix docker compose dosnt show web
Zabbix docker compose dosnt show web

Time:09-21

Im newbie in docker,I try create docker compose file with Zabbix, and all my containers are up,but web interface doesnt work In logs all work,but web interface not work. There is my docker compose yml :

version: "3.5"
 services:
    sql:
     image: mysql:latest
     environment:
       MYSQL_ROOT_PASSWORD: zabbix
       MYSQL_DB: zabbix
       MYSQL_USER: zabbix
       MYSQL_PASSWORD: zabbix
     volumes:
      - ./zabbix-mysql:/home/grey/mysql
     ports:
      - "3306:3306"
     restart: always

    zabbix:
     image: zabbix/zabbix-server-mysql
     environment:
          DB_SERVER_HOST: sql
          MYSQL_DB: zabbix
          MYSQL_USER: root
          MYSQL_PASSWORD: zabbix
          ZBX_VALUECACHESIZE: 64M
          ZBX_CACHESIZE: 128M
          ZBX_TRENDCACHESIZE: 128M
     volumes:
      - ./zabbix-serv:/home/grey/zabbix-server
     links:
       - sql
     ports:
      - "10051:10051"
     restart: always
    
     zabbix-web:
     image:  zabbix/zabbix-web-apache-mysql
     environment:
        DB_SERVER_HOST: sql
        MYSQL_USER: root
        MYSQL_PASSWORD: zabbix
        MYSQL_DB: zabbix
        ZBX_SERVER_HOST: zabbix
        ZBX_SERVER_PORT: 10051
        PHP_TZ: Europe/Paris
     links:
      - zabbix
      - sql
     ports:
      - "80:80"
      - "443:443"
     restart: always

    zabbix-agenr:
     image:  zabbix/zabbix-agent
     environment:
        DB_SERVER_HOST: sql
        MYSQL_USER: root
        MYSQL_PASSWORD: zabbix
        MYSQL_DB: zabbix
        ZBX_SERVER_PORT: 10051
        ZBX_SERVER_HOST: zabbix
     links:
      - zabbix
     restart: always

Could you help me and explain why web dont work? Thank you

CodePudding user response:

Your port mappings for the service zabbix-web are wrong:

zabbix-web:
     image:  zabbix/zabbix-web-apache-mysql
     ports:
      - "80:80"
      - "443:443"

Apache is running on 8080 and 8443 so correct is:

zabbix-web:
     image:  zabbix/zabbix-web-apache-mysql
     ports:
      - "80:8080"
      - "443:8443"

Also many of the things in your configuration are not really needed.

I post here the version that worked for me to test the web interface (keep in mind you have to wait for a bit for everything to be running). Also I have it here running at http://localhost:8999

version: "3.5"

services:
  sql:
     image: mysql:latest
     environment:
       MYSQL_ROOT_PASSWORD: zabbix
       MYSQL_DB: zabbix
       MYSQL_USER: zabbix
       MYSQL_PASSWORD: zabbix
     volumes:
      - ./zabbix-mysql:/home/grey/mysql
     restart: always

  zabbix:
     image: zabbix/zabbix-server-mysql
     environment:
          DB_SERVER_HOST: sql
          MYSQL_DB: zabbix
          MYSQL_USER: root
          MYSQL_PASSWORD: zabbix
          ZBX_VALUECACHESIZE: 64M
          ZBX_CACHESIZE: 128M
          ZBX_TRENDCACHESIZE: 128M
     volumes:
      - ./zabbix-serv:/home/grey/zabbix-server
     restart: always
     depends_on:
       - sql
    
  zabbix-web:
     image:  zabbix/zabbix-web-apache-mysql
     environment:
        DB_SERVER_HOST: sql
        MYSQL_USER: root
        MYSQL_PASSWORD: zabbix
        MYSQL_DB: zabbix
        ZBX_SERVER_HOST: zabbix
        ZBX_SERVER_PORT: 10051
        PHP_TZ: Europe/Paris
     ports:
      - "8999:8080"
     restart: always
     depends_on:
       - zabbix-agenr

  zabbix-agenr:
     image:  zabbix/zabbix-agent
     environment:
        DB_SERVER_HOST: sql
        MYSQL_USER: root
        MYSQL_PASSWORD: zabbix
        MYSQL_DB: zabbix
        ZBX_SERVER_PORT: 10051
        ZBX_SERVER_HOST: zabbix
     restart: always
     depends_on:
       - zabbix
  • Related