SSH connection refused on azure vm -
i able render public ip of virtual machine on chrome not able connect ssh, raising error: connect host xxx.xxx.xxx.xx port 22: connection refused. when check virtual machine on portal, there no security group assigned it. this? how can fix it?
according description, if want ssh docker image, should install ssh on image, , open port image, run centos image example:
docker pull centos:centos6 docker run -i -t centos:centos6 yum install openssh-server openssh-client(install ssh) chkconfig sshd on passwd(reset root password) exit docker commit 332b19ca916c centos/centosssh (commit image) docker run -i -t -d -p 50001:22 centos/centosssh (nat container) docker attach containerid (connect container) vi /etc/ssh/sshd_config (modify sshd config) change usepam no service sshd start
then open port 50001 in azure nsg.
this time, can use ssh connect it:
update:
i use cli 2.0 create vm docker extension, , change public ip address static, , use command sudo docker run -d -p 80:80 nginx
run container on vm. use chrome test nginx, works fine, , can ssh azure vm public ip , fqdn. nginx container:
jason@mydockervm:~$ docker ps -a container id image command created status ports names 61e10ebb6d22 nginx "nginx -g 'daemon ..." 4 minutes ago 4 minutes 0.0.0.0:80->80/tcp, 443/tcp kind_leavitt
try use fqdn ssh host:
[c:\~]$ ssh jason@mypublicdns.eastus.cloudapp.azure.com host 'mypublicdns.eastus.cloudapp.azure.com' resolved 52.186.123.151. connecting 52.186.123.151:22... connection established. escape local shell, press 'ctrl+alt+]'. welcome ubuntu 14.04.4 lts (gnu/linux 3.19.0-65-generic x86_64) * documentation: https://help.ubuntu.com/ system information of fri apr 7 06:40:06 utc 2017 system load: 0.31 processes: 118 usage of /: 5.8% of 28.80gb users logged in: 1 memory usage: 12% ip address eth0: 10.0.0.4 swap usage: 0% ip address docker0: 172.17.0.1
try use public ip address ssh host:
[c:\~]$ ssh jason@52.186.123.151 connecting 52.186.123.151:22... connection established. escape local shell, press 'ctrl+alt+]'. welcome ubuntu 14.04.4 lts (gnu/linux 3.19.0-65-generic x86_64) * documentation: https://help.ubuntu.com/ system information of fri apr 7 06:40:55 utc 2017 system load: 0.21 processes: 119 usage of /: 5.8% of 28.80gb users logged in: 1 memory usage: 12% ip address eth0: 10.0.0.4 swap usage: 0% ip address docker0: 172.17.0.1
Comments
Post a Comment