Home > other >  Docker container IP Settings
Docker container IP Settings

Time:09-22

1, through the way of pipework, set up a container of IP, but under the same host machine can ping each other between containers, but SSH even not in the past, is to lose the password, immediately disconnect); By hosting the SSH into the machine in the container; Can also through other hosting SSH to connect to other hosting container; But between different containers SSH failed;
2, also tried by weave, but SSH to the container of IP, is to enter the host machine,

Please friends help solve,

CodePudding user response:

Your SSH docker container port is not mapped to the host machine, you open a port mapping to the docker port 22

CodePudding user response:

Should be SSH and PAM set problems
Add in Dockerfile
 RUN SSH - the keygen - q - N "" -t rsa -f/etc/SSH/ssh_host_rsa_key; \ 
SSH - the keygen - q - N "" -t ecdsa -f/etc/SSH/ssh_host_ecdsa_hey; \
SSH - the keygen - q - N "" -t dsa -f/etc/SSH/ssh_host_ed25519_key; \
Sed -i "s/^ \ \ s * (session + required \ \ s \ \ s + pam_loginuid \. So \)/# \ 1/g"/etc/PAM. D/SSHD; \
Sed -i "/^ \ s * # PermitRootLogin \ s * */aPermitRootLogin yes"/etc/SSH/sshd_config; \
Echo 'root: admin123 | chpasswd
build again mirror
  • Related