0

I can't connect a local database to docker-compose running a Superset container.

I'm using Superset to show information of a database that is stored locally. While Superset is running as a container ran by docker-compose. Superset can't access the database duo to the container network not being able to access the same IP address and port of localhost.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
flu-iid
  • 3
  • 1

2 Answers2

0

For this your Apache Superset should also running on your local system.

Lakshya Tyagi
  • 79
  • 1
  • 5
  • This statement is incorrect. Apache Superset mentions this setup in their [own documentation](https://superset.apache.org/docs/installation/installing-superset-using-docker-compose#5-connecting-superset-to-your-local-database-instance). – Sebastian Liebscher Jul 25 '23 at 12:44
0

You can connect to your local database by using the docker daemon's network bridge docker0.

  • check ip addr show docker0 and look for inet
  • switch from localhost to docker0's address (example 172.17.0.1)
~ ip addr show docker0
9: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 1a:2b:3c:4d:5e:6f brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever

Apache Superset's documentation also mentions this here. More information on your underlying question: From inside of a Docker container, how do I connect to the localhost of the machine?