Did you change the /etc/postgresql/10/main/pg_hba.conf file configuration to allow connections? if not take a look at https://www.thegeekstuff.com/2014/02/enable-remote-postgresql-connection/ this should guide you but basically you need to change the METHOD to `trust` on the 127.0.0.1 address and eventually of the ::1 as well.