mirror of
https://github.com/sickcodes/Docker-OSX.git
synced 2026-01-11 21:10:25 +01:00
Can't SSH into naked container with my own CI/CD .img #184
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @JB-CHAUVIN on GitHub (May 6, 2021).
Hello,
I configured an image using the following command :
What I've done :
Then, I saved the HDD :
But when I start it naked, I can't SSH into it...
Error is :
ssh mobile@localhost -p 50922
kex_exchange_identification: Connection closed by remote host
Any ideas why ?
Please find Docker's log when I run naked container, and some info about my system.
OS related issued, please help us identify the issue by posting the output of this :
@sickcodes commented on GitHub (May 6, 2021):
I also had this problem yesterday, but it was my VPN. Do you have a VPN on?
@sickcodes commented on GitHub (May 6, 2021):
Also double check your username
ssh mobile@localhost -p 50922and/or-i sshkey_rsa@JB-CHAUVIN commented on GitHub (May 7, 2021):
Hello @sickcodes , thanks for the reply.
No I am not using VPN on my docker computer.
So weird, port SSH is running, but I can't logging at all into the naked one (SSH is working fine on big sur image with display).
@ficofer commented on GitHub (May 9, 2021):
I have followed your steps @JB-CHAUVIN and I am having a similar issue although I am mapping the ports 1:1 from the VM to the container this works when I run the
sickcodes/docker-osx:big-surimage when I created it.But when I run with the img I copied from
docker cpto usesickcodes/docker-osx:nakedit seems no port are open neither the VNC one or the SSH one.To be honest I am not sure how to debug it further from here. Your screenshots above are the same thing I see in my system, the port open and docker listening. on those port for both ssh and vnc.
Can it be that the container is getting stuck in the disk picker and never booting ?
@sickcodes commented on GitHub (May 9, 2021):
Can you
docker pullthe latest images? I can see QEMU 5.2 in the screenshot, the new images are using QEMU 6:@ficofer commented on GitHub (May 9, 2021):
Trying with latest image:
I see in the VM ports are mapped to docker
It seems 5999 is not open on the host machine, but 50922 on the other hand is open and proxied to the container, this might be because naked image only accept and open port 50922 in its docker file (no vnc) but still is not accesible after it started.
Can it be that the mac we installed is not listening in
10022? is listening in 22 as defaulted ?Happy to help debug this further if something is needed to troubleshoot.
Edit: I also notice that the image I have created even though it has autologin enable it does not auto login.
@ficofer commented on GitHub (May 9, 2021):
I have try booting up again the machine with the big-sur docker image, changing the port for ssh from 22 to 10022 in
/etc/servicesand copy this new image to my local filesystem to try to start naked docker image with the new created img from that and still same resultsEDIT:
Another test I did was:
This actually start working and ssh reply to me asking for a password but the password I set up for the user does not work.
@coppercash commented on GitHub (May 17, 2021):
Same problem here.
I have
big_user.ssh:50922big_user.vnc:5900qemu.vnc:5999running in my container.I tried following connections:
docker exec -it container bash;ssh user@localhost -p 10022)@coppercash commented on GitHub (May 17, 2021):
Found something new.
After added
--network=host, I can connect tobig_sur:10022&big_sur:5900from a remote host now.BTW, I am using
podman version 3.1.2&QEMU emulator version 6.0.0.Given that this problem happens with both podman & docker,
I think they are not responsible.
@ficofer commented on GitHub (May 17, 2021):
@coppercash can you share the complete command you run to accomplished this ?
I have just re tried and I got this ports listening on the docker host machine, but then no route to the container running the OSX
tcp 0 0 0.0.0.0:10022 0.0.0.0:* LISTEN 11489/qemu-system-x
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 11489/qemu-system-x
And same issue I had it seems that something is open in the port but nothing is listening in ssh.
I will really appreciate your docker run command for the naked image to see if I am setting some options wrong.
@coppercash commented on GitHub (May 18, 2021):
Here it is, the complete command.
And as I said, instead of docker, I use podman.
But it should make little difference.
podman is a drop-in replacement to docker.
Although, now,
I can ssh to the macOS running inside the container from a remote host,
this is a barely acceptable workaround.
Because after adding
--network=hostthere are two problems:Gonna dig deeper when I get some time.
@sickcodes commented on GitHub (May 18, 2021):
@coppercash solved the above issue with Docker-OSX podman in the following comment: https://github.com/sickcodes/Docker-OSX/issues/246
@coppercash commented on GitHub (May 19, 2021):
This is my current command to boot.
And, still, ssh just stucks at the last line.
The same goes for vnc.
I think there is still something wrong with the port binding.
@coppercash commented on GitHub (May 26, 2021):
I think I found the cause.With command
ss(docker exec -it docker-osx bashin advance), I gotIt seems that qemu only opens port 10022 to local access.And all accesses from outside the container are blocked.
Confirmed by viewing the sshd log inside big sur, with
log config --mode "level:debug" --subsystem com.openssh.sshdlog stream --level debug 2>&1 | grep sshdWhen I connect from outside the container, nothing appeared in the log.But when from inside, a lot of related logs.
@coppercash commented on GitHub (May 28, 2021):
It turned out the cause I found was not the real one.
However, now, I got a solution, though I still don't know the cause.
Previously I was using
podman, which is slightly different withdocker.The strictly drop-in replacement should be
sudo podman,which is the command I am currently use (and it works).
I suspect that plain
podmanlacks of somecaps to alter the rules withiniptables,maybe
NET_ADMINorNET_RAW.Since
sudo podmanis good enough for me,I won't spend more time on finding out the real cause.
@JB-CHAUVIN commented on GitHub (Jun 10, 2021):
Have we found any solution ?
I keep getting the same "wrong password" error.
Port looks running, but I can't log in into the MAC DOCKER via SSH.
PS : I don't have podman on my system.
@coppercash commented on GitHub (Jun 11, 2021):
Have you tried
--networt=host?@wfeii1980 commented on GitHub (Jan 16, 2023):
I have the same problem?
summary:
Use -- netword=host to configure,Connect 10022 port。
or
podman exec -it a96e861916e6 /bin/bash -c "ssh user@localhost -p 10022"
There are no problems!
Only the mapped 50922 port connection did not respond, I suspect that it is a problem with podman. I don't know whether docker also has this problem.
@bphd commented on GitHub (Mar 17, 2023):
PodMan correct security breaches by limiting capacities of the container. Using it with sudo or --privilegied basically make it like docker and fail the purpose. Docker-OSX should fine tune what it needs and configure PodMan to work with it, rather than just exploding all securities and executing as root
@M-Taan commented on GitHub (Aug 22, 2023):
Hey @ficofer just wondering if you managed to get it working, having the same issue. Thanks!