Ngrok: Expose Database in Docker Container

I have a web application built with Elixir that uses a Postgres database in a docker container (https://hub.docker.com/_/postgres/).

I need to expose the web interface (running on port 4000) and the database in the docker container.

  • Pemnanently caching results of a Dockerfile command for development
  • Why can't I use Docker CMD multiple times to run multiple services?
  • Local docker volume with write permission from www-data
  • Dockerized database passwords management
  • Installing sensu, sensu-dashboard does not install
  • Mysql installed and persisting data in docker images
  • I tried adding this to my configuration files:

    tunnels:
      api:
        addr: 4000
        proto: http
      db:
        addr: 5432
        proto: tcp
    

    Then in my Elixir config/dev.exs I add this under the database configuration:

    ... 
    hostname: "TCP_URL_GIVEN_BY_NGRROK"
    

    When I attempt to start the application, it says failure to connect to the database.

    The docker command that I used is:

    docker run --name phoenix-pg -e POSTRGRES_PASSWORD=postgres -d postgres

    What am I doing wrong?

  • Zookeeper my ID not in the peer list
  • How to run pip3+git from behind proxy with docker?
  • Invalid Registry Endpoint pushing docker image
  • Connect to remote Docker via Node.js
  • Unable to mount MySQL data volume to Kubernetes Minikube pod
  • Docker compose build error
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.