I am port forwarding with ssh to a remote db like so from a docker container:
ssh -o "ServerAliveInterval 15” -o -f -N -q -L 8000:localhost:8080 root@6.10.125.60
This works and I can access the database normally. I added ServerAliveInterval so that the connection is kept alive even when client is idle. I have realised that this does not work from a docker container and connection is lost after several minutes.
I used the exact same command locally (not from docker) and it works as intended, i.e. no connection loss.
So my workaround to this was to port forward locally and then access the database from docker with an hostname alias.
The above worked and solved my connection lost issue. My question is why is this the case? I.e. why does ServerAliveInterval seem to have no effect when run from insid a docker container?