title: connect to docker postgresql from remote grafana
body: <p>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:</p>
  <pre><code>version: '3.8'
  
  services:
    
    timescale:
      image: timescale/timescaledb-ha:pg14-latest
      container_name: timescaledb
      ports:
        - &quot;5432:5432&quot;
      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
  </code></pre>
  <p>Upon checking my network with <code>network inspect trade-net</code> I get:</p>
  <pre><code>&quot;IPv4Address&quot;: &quot;172.22.0.3/16&quot;
  </code></pre>
  <p>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:</p>
  <p><a href="https://i.stack.imgur.com/7TtZh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7TtZh.png" alt="enter image description here" /></a></p>
  <p>I have tried to fill this with :</p>
  <pre><code>Host: 172.22.0.3:5432
  Database: postgres
  User: postgres Password: password
  </code></pre>
  <p>But the connection is never established.</p>
  <p>One thing to note is that my <code>postgresql.conf</code> file has :</p>
  <pre><code>listen.addresses = '*'
  </code></pre>