Zabbix docker compose dosnt show web - docker

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

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

Connection refused: Docker and Symfony

I'm trying to connect my Symfony project with a database in a Docker environment but unfortunately, the message is always: Connection refused.
My .env configuration (Symfony file):
DB_USER=root
DB_PASSWORD=root
DB_HOST=127.0.0.1
DB_PORT=3306
DB_NAME=db
DATABASE_URL=mysql://${DB_USER}:${DB_PASSWORD}#${DB_HOST}:${DB_PORT}/${DB_NAME}
and my Docker-compose configuration:
version: '3.8'
services:
db:
image: mariadb
container_name: db-docker-env
restart: always
volumes:
- db-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "db"
MYSQL_USER: "root"
MYSQL_PASSWORD: "root"
networks:
- dev
command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
ports:
- "3306:3306"
phpmyadmin:
image: phpmyadmin
container_name: phpmyadmin-docker-env
restart: always
depends_on:
- db
ports:
- 8080:80
environment:
PMA_HOST: db
networks:
- dev
I searched for a long time on the Internet, but unfortunately to no avail. Is there a solution to that?

docker: Why do I access to phpmyadmin?

and excuse me for my English.
I'm using docker in wsl 2 and I have a docker application with three images: laravel, phpmyadmin and mysql
my problem is what I can not access to phpmyadmin.¿can I help me please?
Attached image of the docker application running.
Whe I tye to access to phpmyadmin, appearc not found page.
docker-compose.yml
version: '3.8'
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.0
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.0/app
ports:
- '${APP_PORT:-80}:80'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
mysql:
image: 'mysql:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' #empty(niether)
MYSQL_DATABASE: '${DB_DATABASE}' #fastfood
# MYSQL_USER: '${DB_USERNAME}' #root
MYSQL_PASSWORD: '${DB_PASSWORD}' #empty
MYSQL_HOST: '${DB_HOST}' #localhost
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
volumes:
- 'sailmysql:/var/lib/mysql'
networks:
- sail
phpmyadmin:
image: 'phpmyadmin'
container_name: pma
environment:
PMA_HOST: '${DB_HOST}' #localhost
PMA_PASSWORD: '${DB_PASSWORD}' #empty(niether)
PMA_ARBITRARY: 1
restart: always
ports:
- 8081:80
depends_on:
- mysql
networks:
- sail
networks:
sail:
driver: bridge
volumes:
sailmysql:
driver: local
information
windows 10 19052.1052
docker 3.5.1
Use http://localhost:8081/ instead.
/phpmyadmin is just a route that set for the server software like wamp for you to access phpmyadmin easily.
Since you have defined in your docker-compose.yml
phpmyadmin:
image: 'phpmyadmin'
...
ports:
- 8081:80
...
which is port 8081

Connect to networked mysql docker container with local client

I have just followed a tutorial on using Docker. I started with installing different containers and when I got to mysql, i installed it by running
docker container run -d -p 3306:3306 --name mysql --env MYSQL_ROOT_PASSWORD=123456 mysql
After the container has been created, I have been able to connect to MySQL with Heidi, by using 127.0.0.1, root and 123456 as password.
I eventually moved forward with another tutorial on installing WordPress with docker.
https://www.youtube.com/watch?v=pYhLEV-sRpY
The yaml for setting up the containers is bellow. Everything works just fine, but when it comes to connecting to the database using Heidi, I just do not get what to do - what connection data to use or what to change in the yaml to be able to connect from local machine.
version: '3'
services:
# Database
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
networks:
- wpsite
# phpmyadmin
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- '8080:80'
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: password
networks:
- wpsite
# Wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- '8000:80'
restart: always
volumes: ['./:/var/www/html']
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
networks:
- wpsite
networks:
wpsite:
volumes:
db_data:
You should expose 3306 port to local machine. Then, you can connect to MySQL by using host=127.0.0.1.
Update the yaml file like this:
version: '3'
services:
# Database
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
networks:
- wpsite
...

Cannot connect to second docker container - port error

I have two directories each running an identical docker build except for the allocated ports. I cannot connect to one of the containers in my localhost.
After running the docker ps command I see that 80/tcp being prepended to my second recipe-blog container. Below is my yml file, its nothing crazy, just setting up a database running php my admin and have it connect to a WordPress install. I also attached an image of the docker ps command.
services:
# Database
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
networks:
- wpsite
# phpmyadmin
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- '9090:90'
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: password
networks:
- wpsite
# Wordpress
wordpress:
depends_on:
- db
image: wordpress:5.3.0
ports:
- '9000:90'
restart: always
working_dir: /var/www/html
volumes:
- ./wp-content:/var/www/html/wp-content
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
networks:
- wpsite
networks:
wpsite:
volumes:
db_data: {}
wp-content:
Once again - finalsandbox_ I can connect to fine, I cannot connect to recipe-blog_. The only difference between the two yml files is that for the recipe-blog_ I changed the ports to be 9090:90 instead of 8080:80 and 9000:90 instead of 8000:80.
Thanks in advance.
It works for me, example
version: "3"
services:
# Database
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
networks:
- wpsite
# phpmyadmin
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- '9090:80'
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: wordpress
networks:
- wpsite
# Wordpress
wordpress:
depends_on:
- db
image: wordpress:5.3.0
ports:
- '9000:80'
restart: always
working_dir: /var/www/html
volumes:
- ./wp-content:/var/www/html/wp-content
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
networks:
- wpsite
networks:
wpsite:
volumes:
db_data: {}
wp-content:
Change all the ports assigned by 90 to 80.
docker-compose up -d
with your we-browser favorite, connect to http://127.0.0.1:9000 and http://127.0.0.1:9090

Why I cant connect to database if I have volumes?

I have next docker-compose.yml
version: '3'
services:
webserver:
build: './Docker/apache-php/'
depends_on:
- db
ports:
- "80:80"
volumes:
- ./:/var/www/html/
db:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: dmm
MYSQL_USER: dmm
MYSQL_PASSWORD: password
That works nice. I can connect to database from webserver using db:3306 adress.
But if I add any volume to db container like
version: '3'
services:
webserver:
build: './Docker/apache-php/'
depends_on:
- db
ports:
- "80:80"
volumes:
- ./:/var/www/html/
db:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: dmm
MYSQL_USER: dmm
MYSQL_PASSWORD: password
volumes:
- ./db/:/var/lib/mysql/
db:3306 refuses all conections
Whats wrong?

Resources