How to connect to the Portal internal Postgresql database using admin console on a remote machine

Document ID : KB000102941
Last Modified Date : 21/06/2018
Show Technical Document Details
Question:
How can I  map the 5432 port that Postgress database docker container is using so it can be accessed remotely and use admin tool such as PgAdmin to connect.
Answer:
By default the port 5432 to is only available to the Docker host itself and  you are not be able to reach the internal port on the Docker portaldb container.
from a remote machine,you can  make docker publish the port for the outside world by running :
 
docker service update --publish-add "5432:5432" portal_portaldb --detach=false
 
This will add the port 5432 from the docker portaldb container a public port 5432 on the local docker service. 
After that you are can connect to the Postgress database from a remote box using PgAdmin. on port 5432