Home > other >  Docker run container used -.net=host, how to connect to the container
Docker run container used -.net=host, how to connect to the container

Time:09-25

Docker at startup when the Container if used -.net=host parameters, how to connect to the Container inside?
In default to bridge network mode can be added in the Dockerfile
 CMD/usr/sbin/SSHD & amp; & Start - app. Sh 
,
So that you can in the SSHD when the Container is started, you can remote to the Container,
But in the host network mode, as if it won't work ah, see someone said using the exec, I tried the
 
Root @ debian:/home/docker/videotracker - docker - debian7_32bit/kafka# docker exec 5684 aa299c11/usr/sbin/SSHD -p 3333
Root @ debian:/home/docker/videotracker - docker - debian7_32bit/kafka# ps - ef | grep SSHD
463 1 0 May07 root? 00:00:00/usr/sbin/SSHD
637, 463 May07 root? 00:00:03 SSHD: root @ PTS/2
1849, 463 May07 root? 00:00:03 SSHD: root @ PTS/5
22733, 463 May08 root? 00:00:00 SSHD: root @ PTS/7
22770 1 0 09:56 root? 00:00:00/usr/sbin/SSHD -p 3333
Root 22772 15033 0 09:56 PTS/8 00:00:00 grep SSHD
27019 1 0 May07 root? 00:00:03 SSHD: root @ PTS/0
27033, 597 May08 root? 00:00:00/bin/sh -c/usr/sbin/SSHD & amp; & Start - zk. Sh
29101, 597 May08 root? 00:00:00/bin/sh -c/usr/sbin/SSHD & amp; & The/usr/bin/start - kafka. Sh

Feel good strange, SSHD didn't run in the container, but run on hostos,
What good method?

CodePudding user response:

Docker yourContainerId exec - it can bash

CodePudding user response:



Should be run on the container already, but can see on the hostos process.


CodePudding user response:

Docker attach the Container
Not to go?
  • Related