I have a linux virtual machine remotely on the cloud hosted at digitalocean, this machine has grafana installed. Locally I have docker and I launched a postgresql server with the following docker-compose.yml:
version: '3.8'
services:
timescale:
image: timescale/timescaledb-ha:pg14-latest
container_name: timescaledb
ports:
- "5432:5432"
volumes:
- timescale-volume:/home/postgres/pgdata/data
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
networks:
- trade-net
networks:
trade-net:
external: true
volumes:
timescale-volume:
external: true
Upon checking my network with network inspect trade-net I get:
"IPv4Address": "172.22.0.3/16"
I would like to connect via grafana now to my postgresql docker container which has been launched from my local machine, the grafana options are the following ones:
I have tried to fill this with :
Host: 172.22.0.3:5432
Database: postgres
User: postgres Password: password
But the connection is never established.
One thing to note is that my postgresql.conf
file has :
listen.addresses = '*'
I have also tried my public IP address from my local machine instead of the docker IP address , but it didn’t work as well. I got my public IP address with this command:
curl ifconfig.me