Normally a CPX console can be accessed in two steps. Firstly, login to host machine and then use docker exec command to access CPX console. Would you like to do it in one step? This is simple and we can indeed use ssh for accessing CPX directly.
First ensure that ssh port is enabled when CPX is created
Creation of bridge mode CPX with ssh access
Below command creates CPX and opens ssh port (and http/s port)
root@ubuntu:~/ws111/rs_111/usr.src# docker run -dt --privileged=true --name test -e EULA=yes --ulimit core=-1 -p 22 -p 80 -p 443 cpx:11.1
d2dbbe29f5b5db39fdc148bd3b9b306d8e96d2a9e0fcf9383ec9dda0bc345747
Below, I checked to ensure that sshd is running in CPX
root@ubuntu:~/ws111/rs_111/usr.src# docker exec -it test bash
root@d2dbbe29f5b5:/# ps ax |grep ssh
70 ? Ss 0:00 /usr/sbin/sshd
187 ? S+ 0:00 grep --color=auto ssh
root@d2dbbe29f5b5:/# exit
exit
Below command shows that we can access CPX directly using command "ssh root@<host-ip> -p 32811". Note that 22/tcp is mapped to 32811 port in host
root@ubuntu:~/ws111/rs_111/usr.src# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d2dbbe29f5b5 cpx:11.1 "/bin/sh -c 'bash -C " 25 seconds ago Up 22 seconds 161/udp, 0.0.0.0:32811->22/tcp, 0.0.0.0:32810->80/tcp, 0.0.0.0:32809->443/tcp test
Now try to access CPX box from another machine.
Access CPX box
root@ubuntu:~/ws111/rs_111/usr.src# ssh root@10.102.53.232 -p 32811
The authenticity of host '[xxxx]:32811 ([xxxx]:32811)' can't be established.
ECDSA key fingerprint is ac:a2:3a:1a:1a:bb:5a:dc:d5:6e:70:4b:99:40:82:9c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[xxxx]:32811' (ECDSA) to the list of known hosts.
root@xxxx's password:
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-91-generic x86_64)
* Documentation: https://help.ubuntu.com/
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
root@d2dbbe29f5b5:~# cli_script.sh "sh ip"
exec: sh ip
Ipaddress Traffic Domain Type Mode Arp Icmp Vserver State
--------- -------------- ---- ---- --- ---- ------- ------
1) 172.17.0.12 0 NetScaler IP Active Enabled Enabled NA Enabled
2) 192.0.0.1 0 SNIP Active Enabled Enabled NA Enabled
Done
https://www.microloadbalancer.com/