Reputation: 365
I have a problem creating a zabbix/zabbix-web-nginx-pgsql:latest
container says that the PostgreSQL server is not available. Waiting 5 seconds,and it does not happen there. I'm new to docker and I have little idea why this happens, I read somewhere that giving value to DB_SERVER_ROOT_USER = "zabbix"
was solved but it did not work. What am I doing wrong?
docker run -e DB_SERVER_ROOT_USER="zabbix" zabbix/zabbix-web-nginx-pgsql:latest
** Deploying Zabbix frontend (nginx) with postgresql database
** Preparing the system
** Preparing Zabbix web-interface
*********************
* DB_SERVER_HOST: postgres-server
* DB_SERVER_PORT: 5432
* DB_SERVER_DBNAME: zabbix
* DB_SERVER_ZBX_USER: zabbix
* DB_SERVER_ZBX_PASS: zabbix
***********************
**** PostgreSQL server is not available. Waiting 5 seconds...
**** PostgreSQL server is not available. Waiting 5 seconds...
**** PostgreSQL server is not available. Waiting 5 seconds...
Upvotes: 2
Views: 6939
Reputation: 1
in file ./zbx_env/var/lib/postgresql/data/pg_hda.conf
# IPv4 local connections:
host all all 127.0.0.1/32 trust
change to
host all all 0.0.0.0/0 trust
Upvotes: 0
Reputation: 59
In new versions of Docker, it is considered correct to use the "Network"
step 1:
docker network create zabbix-network
for convenience, you can create a volume for the database:
docker volume create zabbix-postgres-volume
step 2: run postgres image
docker run -d -it --name zabbix-postgres --network zabbix-network -e POSTGRES_USER=zabbix -e POSTGRES_PASSWORD=zabbix -v zabbix-posgres-volume:/var/lib/postgresql/data postgres
step 3: run zabbix-server image
docker run -it -d --name zabbix-server --network zabbix-network -p 10051:10051 -e DB_SERVER_HOST=zabbix-postgres -e POSTGRES_USER=zabbix -e POSTGRES_PASSWORD=zabbix zabbix/zabbix-server-pgsql
step 4:
Now you can check the correct connection by logging in PostgreSQL
docker exec -it zabbix-postgres sh
# su
root@234afbed:/# psql -U zabbix
zabbix=# \dt
if everything is correct, then you should see 149 tables created in the database
Upvotes: 4
Reputation: 25
Please try to run the zabbix container with --network=host (only for linux)
I had a similar issue and solved after the inclusion of --network
You can find more details here. From inside of a Docker container, how do I connect to the localhost of the machine?
Upvotes: 0
Reputation: 28733
zabbix/zabbix-web-nginx-pgsql image is a Zabbix frontend based on Nginx with PostgreSQL database support. It doesn't have PostgreSQL database inside it. Zabbix web interface is a part of Zabbix software. It is used to manage resources under monitoring and view monitoring statistics.
It should be deployed as an addition to Zabbix server (zabbix/zabbix-server-pgsql) and PostrgreSQL (postgres) database.
There is a docker-compose.yaml
example, which can help you to achieve your goal:
version: '3.1'
services:
postgres:
image: postgres
restart: always
environment:
POSTGRES_USER: zabbix
POSTGRES_PASSWORD: zabbix
POSTGRES_DB: zabbix
zabbix-server:
image: zabbix/zabbix-server-pgsql
restart: always
environment:
DB_SERVER_HOST: postgres
POSTGRES_USER: zabbix
POSTGRES_PASSWORD: zabbix
POSTGRES_DB: zabbix
depends_on:
- postgres
zabbix-web:
image: zabbix/zabbix-web-nginx-pgsql
restart: always
environment:
ZBX_SERVER_HOST: zabbix-server
DB_SERVER_HOST: postgres
POSTGRES_USER: zabbix
POSTGRES_PASSWORD: zabbix
POSTGRES_DB: zabbix
depends_on:
- postgres
- zabbix-server
ports:
- 8080:80
Above docker-compose.yaml
allows to deploy PostgreSQL, Zabbix server and Zabbix Web frontend.
After docker-compose up
Zabbix interface will be available on localhost:8080
.
Upvotes: 2