I seem to be missing a key concept because I’m able to connect via ssh with the custom port and then do su postgres -c 'psql discourse'
without a problem. Everything works in this two-step approach but I think what I need in order to connect directly via pgAdmin (for example) is something slightly different.
This is the command I’m using to expose a custom port:
docker run -d -p 2222:22 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ~/.ssh/authorized_keys:/authorized_keys \
--name my-sshd \
-e FILTERS={\"name\":[\"^/app$\"]} -e AUTH_MECHANISM=publicKey \
-e AUTHORIZED_KEYS=/authorized_keys \
jeroenpeeters/docker-ssh
Which allows me to later do this directly (without running the docker container via launcher enter app
):
ssh whatever@host -p 2222
su postgres -c 'psql discourse'
I’ve tried several things, but unsuccessfully. I feel like there should be a way to do ssh whatever@host -p XXXX
and connect directly to the database (which is probably what pgAdmin is expecting)