I usually do a:
ssh --oStrictHostKeyChecking=no -L 33333:remote_server user@domain.name -i /usr/lib/key.pem
from my local computer to a remote aws server. Now I would like to connect AUTOMATICALLY from my ssh-container service in a container when the container is load. Is that possible? if so , what i'm doing wrong? how can I achieve this?
Container is loaded, if execute "ssh --oStrictHostKeyChecking=no -L 33333:remote_server user@domain.name -i /usr/lib/key.pem" from the shell it connect to my remote though
The reason why I'm trying this is because I have another service "phpmyadmin-container" which require that ssh connection to load mysql datadb through ssh tunnel.
Aside that I have another problem to solve with phpmyadmin(this if I go into ssh-container shell's I can see that I'm not connected.
Any help would be appreciated.
my yml file look like:
version: '3'
services:
phpmyadmin-container:
image: phpmyadmin/phpmyadmin
environment:
PMA_HOST: 127.0.0.1
PMA_PORT: 33333
PMA_USERNAME: user
PMA_USERNAME_PASSWORD: pass
ports:
- '8080:80'
ssh-container:
image: nazarpc/webserver:ssh-v1
restart: always
volumes:
# this where I have the key.pem (could be anywhere ,am i right?)
- /usr/lib:/usr/lib
command: ssh --oStrictHostKeyChecking=no -L 33333:remote_server user@domain.name -i /usr/lib/key.pem
#I have also use it the way ["ssh", "--oStrictHostKeyChecking=no" ...]