ssh daemon with authorization_keys given as parameter
1.0K
This docker image is built after alpine-sshd.
It adds a simple mean to create an authorized_keys file inside a container.
docker run -dtP -e "AUTHORIZED_KEYS=`cat ~/.ssh/id_rsa.pub`" ybrdx/sshd-authkeys
docker run -dtP -e "AUTHORIZED_KEYS=`cat ~/.ssh/authorized_keys`" ybrdx/sshd-authkeys
docker run -dtP --name ssh-gtw -e "AUTHORIZED_KEYS=`cat ~/.ssh/id_rsa.pub`" --net my_network ybrdx/sshd-authkeys
I want a way to connect jconsole (a tool to monitor JVM memory profile and many other things) but I do want to keep the JMX port inside the network.
A way to achieve this is to have a ssh dynamic tunnel provided by a container in the network exposing port 22. This way you can plug jconsole to any container in the network seamlessly via its net alias or docker DNS.
The JVM must be told to expose JMX, set the environment variable:
JAVA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
Once you have the ssh gateway container running.
Retrieve its mapped port:
docker port ssh-gtw
Create a dynamic tunnel:
ssh -ND 127.0.0.1:8157 -p MAPPED_PORT -i ~/.ssh/id_rsa [email protected]
Launch jconsole:
jconsole -J-DsocksProxyHost=localhost -J-DsocksProxyPort=8157 service:jmx:rmi:///jndi/rmi://my_service:1099/jmxrmi
Try it with a swarm.
Content type
Image
Digest
Size
3.6 MB
Last updated
almost 10 years ago
docker pull ybrdx/sshd-authkeys