ssh: connect to host 127.0.0.1 port 10022: Connection refused #369

Open
opened 2025-12-29 06:19:20 +01:00 by adam · 6 comments
Owner

Originally created by @ZGuQing on GitHub (Jun 7, 2022).

Run multiple containers at the same time, will appear this mistake:
ssh: connect to host 127.0.0.1 port 10022: Connection refused

Originally created by @ZGuQing on GitHub (Jun 7, 2022). Run multiple containers at the same time, will appear this mistake: ssh: connect to host 127.0.0.1 port 10022: Connection refused
Author
Owner

@csonuryilmaz commented on GitHub (Jun 12, 2022):

Hi @ZGuQing, running multiple containers at the same time requires to set different SSH ports on host.

I'm using both Monterey and Big Sur on my system as guest OS at the same time concurrently. But for Monterey using 50922:10022 port mapping and for Big Sur using 50923:10022 port mapping.

@csonuryilmaz commented on GitHub (Jun 12, 2022): Hi @ZGuQing, running multiple containers at the same time requires to set different SSH ports on host. I'm using both Monterey and Big Sur on my system as guest OS at the same time concurrently. But for Monterey using `50922:10022` port mapping and for Big Sur using `50923:10022` port mapping.
Author
Owner

@ZGuQing commented on GitHub (Jun 13, 2022):

Hi @ZGuQing, running multiple containers at the same time requires to set different SSH ports on host.

I'm using both Monterey and Big Sur on my system as guest OS at the same time concurrently. But for Monterey using 50922:10022 port mapping and for Big Sur using 50923:10022 port mapping.
When creating the container, I mapped different port, but it still doesn't work when running at the same time,
It seems that the 10022 port number conflicts
image

@ZGuQing commented on GitHub (Jun 13, 2022): > Hi @ZGuQing, running multiple containers at the same time requires to set different SSH ports on host. > > I'm using both Monterey and Big Sur on my system as guest OS at the same time concurrently. But for Monterey using `50922:10022` port mapping and for Big Sur using `50923:10022` port mapping. When creating the container, I mapped different port, but it still doesn't work when running at the same time, It seems that the 10022 port number conflicts ![image](https://user-images.githubusercontent.com/49809237/173314399-bf9dd641-6a15-4872-8ce9-968823005ee0.png)
Author
Owner

@csonuryilmaz commented on GitHub (Jun 13, 2022):

Hi @ZGuQing, as far as I understand from log, it does not seem to be SSH port conflict.

Are you using same .img disk file for both containers? (It should be different for each container.)

Because according to logs it can't get "write" lock. So one one of the containers is not starting. For this reason we see 10022 connection refused in logs. Qemu virtual machine is not alive.

@csonuryilmaz commented on GitHub (Jun 13, 2022): Hi @ZGuQing, as far as I understand from log, it does not seem to be SSH port conflict. Are you using same `.img` disk file for both containers? (It should be different for each container.) Because according to logs it can't get "write" lock. So one one of the containers is not starting. For this reason we see `10022 connection refused` in logs. Qemu virtual machine is not alive.
Author
Owner

@ZGuQing commented on GitHub (Jun 13, 2022):

Hi @ZGuQing, as far as I understand from log, it does not seem to be SSH port conflict.

Are you using same .img disk file for both containers? (It should be different for each container.)

Because according to logs it can't get "write" lock. So one one of the containers is not starting. For this reason we see 10022 connection refused in logs. Qemu virtual machine is not alive.

Yes, I used the same .img disk file for both containers, you mean I need to redownload an different .img?

@ZGuQing commented on GitHub (Jun 13, 2022): > Hi @ZGuQing, as far as I understand from log, it does not seem to be SSH port conflict. > > Are you using same `.img` disk file for both containers? (It should be different for each container.) > > Because according to logs it can't get "write" lock. So one one of the containers is not starting. For this reason we see `10022 connection refused` in logs. Qemu virtual machine is not alive. Yes, I used the same `.img` disk file for both containers, you mean I need to redownload an different `.img`?
Author
Owner

@ZGuQing commented on GitHub (Jun 13, 2022):

Hi @ZGuQing, as far as I understand from log, it does not seem to be SSH port conflict.

Are you using same .img disk file for both containers? (It should be different for each container.)

Because according to logs it can't get "write" lock. So one one of the containers is not starting. For this reason we see 10022 connection refused in logs. Qemu virtual machine is not alive.

Thanks for your answer, I copied a .img file and it solved the problem

@ZGuQing commented on GitHub (Jun 13, 2022): > Hi @ZGuQing, as far as I understand from log, it does not seem to be SSH port conflict. > > Are you using same `.img` disk file for both containers? (It should be different for each container.) > > Because according to logs it can't get "write" lock. So one one of the containers is not starting. For this reason we see `10022 connection refused` in logs. Qemu virtual machine is not alive. Thanks for your answer, I copied a .img file and it solved the problem
Author
Owner

@VagnerSilva commented on GitHub (Aug 21, 2022):

I solved of the following mode

wsl --shutdown

restart docker

wsl (distro)

mv /tmp/.X11-unix    /tmp/.X11-unix.bk
docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    -e GENERATE_UNIQUE=true \
    sickcodes/docker-osx:auto

@VagnerSilva commented on GitHub (Aug 21, 2022): I solved of the following mode ``` wsl --shutdown ``` restart docker wsl (distro) ``` mv /tmp/.X11-unix /tmp/.X11-unix.bk ``` ``` docker run -it \ --device /dev/kvm \ -p 50922:10022 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ -e GENERATE_UNIQUE=true \ sickcodes/docker-osx:auto ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX-sickcodes#369