When running Appsmith locally on my machine, I’d like to connect to a local Mysql/Postgresql server. Since Appsmith is run via Docker, by default it doesn’t have access to the host machine’s ports. Hence, creating a datasource that connects to
localhost:5432 doesn’t work.
What do I do?
You can find the host IP via the command:
ip addr show docker0
The output will be the IP of the of the host machine for that container.
Assuming the output is:
172.17.0.4 , you can then connect to your local databases via:
172.17.0.4:3306 (Mysql) or
Mac OS X & WSL
You can connect to databases on your host machine via
host.docker.internal . So,
host.docker.internal:3306 (Mysql) or