나는 다음을 사용하여 이미지를 사용자 정의했습니다.데비안: 대단하다. mode 를 통해 설치한 후 bridge
호스트 시스템(Windows 10)에서 SSH를 통해 컨테이너에 로그인할 수 있습니다. 그런데 host
모드로 전환한 후 로그인이 되지 않습니다. 나는 전에 시도했다Docker0ip:172.17.0.1,eth0ip:192.168.65.4,로이프:127.0.0.1이지만 그 중 아무 것도 작동하지 않습니다. 문제가 무엇입니까?
Docker0 ip 및 lo ip는 호스트에서 ping할 수 있지만eth0ip할 수 없습니다. service ssh status
컨테이너 내부에서 실행하면 sshd가 실행 중임을 알 수 있습니다.
1. 작업 실패ssh -v -p 22 [email protected]
C:\Users\guoya>ssh -v -p 22 [email protected]
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Reading configuration data C:\\Users\\guoya/.ssh/config
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 22.
debug1: connect to address 127.0.0.1 port 22: Connection refused
ssh: connect to host 127.0.0.1 port 22: Connection refused
2. 컨테이너를 설치하고 시작합니다.
@echo off
tasklist /FI "IMAGENAME eq docker.exe" | find "docker.exe" > nul
if %errorlevel% equ 0 (
echo Docker is running.
rem Stop and remove containers based on images with repository containing "dobot"
for /f "tokens=1,2" %%A in ('docker ps -a --format "{{.Image}} {{.Names}}" ^| find "dobot"') do (
docker stop %%B
docker rm %%B
)
rem Remove images with repository containing "dobot"
for /f "tokens=*" %%A in ('docker images --format "{{.Repository}}:{{.Tag}}" ^| find "dobot"') do (
docker rmi %%A -f
)
rem Load the Docker image from the tar file in the current directory
docker load -i "%cd%\images\v4vc.tar"
rem Run the Docker container
docker run --dns=8.8.8.8 -d --name=crv4 --net=host dobotv4vc:v450stable_v1
echo ############################################################
echo The v450stable_v1 version of the virtual controller has been successfully installed.
echo ############################################################
) else (
echo *******************************************
echo Docker is not running, please run it first.
echo *******************************************
)
pause
3. 컨테이너 정보:
# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
inet6 fe80::42:66ff:fe01:def6 prefixlen 64 scopeid 0x20<link>
ether 02:42:66:01:de:f6 txqueuelen 0 (Ethernet)
RX packets 187901 bytes 54114300 (51.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 275524 bytes 65536141 (62.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.65.4 netmask 255.255.255.255 broadcast 0.0.0.0
inet6 fe80::1816:9dff:fe76:1e1 prefixlen 64 scopeid 0x20<link>
ether 1a:16:9d:76:01:e1 txqueuelen 0 (Ethernet)
RX packets 249 bytes 55696 (54.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 241 bytes 26463 (25.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 23489 bytes 1229382 (1.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 23489 bytes 1229382 (1.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# service ssh status
sshd is running.