Edit and uncomment line 90 and 92 of the sshd_config file as below
X11Forwarding yes
X11UseLocalhost no
vim /etc/ssh/sshd_config
service sshd restart;
su username;
Quick Launch via ssh
for dynamic ip
docker start container_name
docker container exec -d container_name service ssh start # activates ssh of container with detach mode.
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name | xclip # xclip should be installed
ipaddress=`xclip -o`
ssh username@$ipaddress -X
for static ip
docker start container_name
docker container exec -d container_name service ssh start # activates ssh of container with detach mode.
ssh username@thatStaticIp -X
If you are one liner
create a file without extension at ~/bin/
paste code below
make it executable chmod +x shortcutname
then you can type shortcutname at any directory
for dynamic ip
#!/bin/bash
docker start container_name
docker container exec -d container_name service ssh start # activates ssh of container with detach mode.
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name | xclip # xclip should be installed
ipaddress=`xclip -o`
sleep 0.012
ssh username@$ipaddress -X
for static ip
#!/bin/bash
docker start container_name
docker container exec -d container_name service ssh start # activates ssh of container with detach mode.
sleep 0.012
clear -x
# if you have assigned a static ip when you used run command
ssh username@thatStaticIp -X